akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

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

#define X real()
#define Y imag()
#define x(p) real(p)
#define y(p) imag(p)
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
#define prev(P, i) P[(i-1+P.size())%P.size()]

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

typedef double D;
typedef complex<D> P;
namespace std{
  bool operator < (const P& a, const P& b) {
    return x(a) != x(b) ? x(a) < x(b) : y(a) < y(b);
  }
}

D dot(const P& a, const P& b) {
  return x(conj(a)*b);
}
D cross(const P& a, const P& b) {
  return y(conj(a)*b);
}

struct L : public vector<P> {
  L(const P&a, const P& b) {
    push_back(a);
    push_back(b);
  }
};

typedef vector<P> G;

struct C {
  P p; D r;
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if(cross(b, c) > 0) return +1; //ccw
  if(cross(b, c) < 0) return -1; //cw
  if(dot(b, c) < 0)   return +2; //c-a-b on line
  if(norm(b) < norm(c)) return -2; //a-b-c on line
  return 0;
}

P projection(const L& l, const P& p) {
  D t = dot(p - l[0], l[0] - l[1]) / norm(l[0]- l[1]);
  return l[0] + t * (l[0] - l[1]);
}
P refrection(const L& l, const P& p) {
  return p + 2.0 * (projection(l, p) - p);
}

bool intersectSS(const L& a, const L& b) {
  return ccw(a[0], a[1], b[0]) * ccw(a[0], a[1], b[1]) <= 0
    && ccw(b[0], b[1], a[0]) * ccw(b[0], b[1], a[1]) <= 0;
}
P crossP(const L& a, const L& b) {
  D x = cross(a[1]-a[0], b[1]-b[0]);
  D y = cross(a[1]-a[0], a[1]-b[0]);
  if(abs(x) < EPS && abs(y) < EPS) return a[0];
  return b[0] + y / x * (b[1]-b[0]);
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    vector<P> ps(4);
    rep(i, 4) {
      D x, y;
      cin >> x >> y;
      ps[i] = {x, y};
    }
    auto p = crossP(L{ps[0], ps[1]}, L{ps[2], ps[3]});
    cout << fixed << setprecision(20);
    cout << x(p) << " " << y(p) << endl;
  }
  return 0;
}

Measured memory_bytes: 3284
#!/usr/bin/python
# -*- coding: utf-8 -*-

# 入力はstringで入る．
# intにしたければ int(input())
# floatで受け取ると 1.0 になる．

# 入力 : X
X = int(input())

print((X // 500)*1000 + ((X%500)//5)*5)


Measured memory_bytes: 2940
n = int(input())
ans = []

m = n

for p in range(2, n + 1):
    if p**2 > n or m == 1:
        break

    while m % p == 0:
        m //= p
        ans.append(p)

if m > 1:
    ans.append(m)

print('{}: '.format(n), end='')
print(*ans)

Measured memory_bytes: 7680
import sys
sys.setrecursionlimit(10 ** 6)  # import sysすること！再帰の深さ制限を緩くする
n, m, q = list(map(int, input().split()))
data = []
for i in range(q):
    a, b, c, d = list(map(int, input().split()))
    data.append([a-1, b-1, c, d])


def dfs(t):
    if len(t) == n:
        score = 0
        for a, b, c, d in data:
            if t[b] - t[a] == c:
                score += d
        global ans
        ans = max(ans, score)
        return

    if len(t) == 0:
        s = 1
    else:
        s = t[-1]

    for j in range(s, m+1):
        dfs(t+[j])


ans = 0
dfs([])
print(ans)


Measured memory_bytes: 9224
#include <iostream>
using namespace std;
#include<vector>
int main()
{
  int n;
  cin>>n;
  const int INF=1e9+7;
  vector<long long int>h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];}

  vector<long long int> s(n,INF);
  s[0]=0;
  for(long long int i=0;i<n;i++)
  {
    for(long long int j=i+1;j<=i+2;j++)
    {
      if(j<n)
      s[j]=min(s[j],s[i]+abs(h[j]-h[i]));
    }
 }
 cout<<s[n-1];
 return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, string> duo;

#define TT template<typename T>
#define TTF template<typename T, typename F>
#define ET(T) typename T::value_type
TT inline T sq(T x){return x*x;}
TT inline T In(){T x;cin>>x;return x;}
TT inline void Out(T&x){cout<<x;}
TT inline void sort(T&v){sort(begin(v),end(v));}
TT inline void revs(T&v){reverse(begin(v),end(v));}
TT inline void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT inline int ubnd(T&v,ET(T)&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT inline int lbnd(T&v,ET(T)&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF inline void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF inline void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
#undef TT
#undef TTF
#undef ET

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}

const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000;

int main()
{
  int n;
  while (cin >> n, n){
    map<string, int> cnt;
    cin.ignore();
    for (int i = 0; i < n; i++){
      string line;
      getline(cin, line);
      stringstream ss(line);
      for (string tkn; getline(ss, tkn, ' '); cnt[tkn]++);
    }
    string c = In<string>();
    vector<duo> out;
    for (const auto& si : cnt){
      if (si.first[0] == c[0]){
        out.push_back(duo(-si.second, si.first));
      }
    }
    if (!out.size()) puts("NA");
    else {
      sort(out);
      for (int i = 0; i < (int)out.size() && i < 5; i++){
        if (i) cout << " ";
        cout << get<1>(out[i]);
      }
      cout << "\n";
    }
  }
  return (0);
}
// priority_queue queue deque front stringstream max_element min_element insert count make_tuple

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

#define N 1000000

static int k_operafan[ N ];
static int n_operafan = 0;

static int
isPrime (
  int n
  )
{
  int i;

  if ( n < 2
    || !( n % 2 ) ) return ( 0 );

  for ( i = 3; i * i <= n; i += 2 )
  {
    if ( !( n % i ) ) return ( 0 );
  }

  return ( 1 );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  memset ( k_operafan, -1, sizeof ( k_operafan ) );
  k_operafan[ 0 ] =
  k_operafan[ 1 ] = 0;
  k_operafan[ 2 ] = 1;
  n_operafan = 3;

  for ( ; ; )
  {
    int n;

    if ( scanf ( "%d", &n ) != 1 ) break;

    for ( ; n_operafan <= n; ++n_operafan )
    {
      k_operafan[ n_operafan ] = k_operafan[ n_operafan - 1 ]
                               + !!( isPrime ( n_operafan ) );
    }

    printf ( "%d\n", k_operafan[ n ] );
  }

  return ( 0 );
}

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

int main()
{
	int n;
	char s[2];

	cin >> n >> s;

	while (s[0] != '=') {
		int m;
		cin >> m;

		if (s[0] == '+')
			n += m;
		else if (s[0] == '-')
			n -= m;
		else if (s[0] == '*')
			n *= m;
		else if (s[0] == '/')
			n /= m;

		cin >> s;
	}

	cout << n << endl;
	
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
//#include "stdc++.h"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = max(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, x;
	cin >> n >> x;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	sort(all(v));
	rep(i, n) {
		if (x >= v[i] && i != n - 1) {
			x -= v[i];
			v[i] = 0;
		} else if (i == n - 1) {
			v[i] -= x;
			x = 0;
		}
	}

	cout << count(all(v), 0) << endl;
}


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

const int mod = 1e9 + 7;
const long long INF = 1LL<<60;
using ll = long long;
using P = pair<int,int>;

class UnionFind{
public:
    
    vector<int> Parent;
    
    UnionFind(int N){
        Parent = vector<int>(N, -1);
    }
    
    int root(int A){ 
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    long long size(int A){
        return -Parent[root(A)];
    }
    
    bool connect(int a, int b){
        
        a = root(a);
        b = root(b);
        
        if (a == b) return false;
        
        if (size(a) < size(b)) swap(a, b);
        
        Parent[a] += Parent[b];
        Parent[b] = a;
        return true;
    }
};


//この問題のポイント
//つながっている辺を切断して何かを考える操作は難しい
//
int main(){
    long long n, m;
    cin >> n >> m;
    
    vector<long long> a(m), b(m);
    
    //do not forget to make them to start from 0 index !!!
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    
    vector<long long> inconvenience(m, 0);
    inconvenience[m-1] = n * (n - 1) / 2;
    
    UnionFind Uni(n);
    
    for (int i = m-1; i >= 1; i--){
        if (Uni.root(a[i]) == Uni.root(b[i])) inconvenience[i-1] = inconvenience[i];
        else{
            inconvenience[i-1] = inconvenience[i] - (Uni.size(a[i]) * Uni.size(b[i]));
            Uni.connect(a[i], b[i]);
        }
    }
    
    rep(i, m){
        cout << inconvenience[i] << endl;
    }
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  // 標準入力高速化のおまじない
  // scanfとの同期を切る。以降紛らわしいのでscanf使用不可。
  ios::sync_with_stdio(false);
  // // cin前の自動flashをやめる
  cin.tie(nullptr);
  
  int N,x;
  string result="";
  cin >> N;
  x = N % 10;
  vector<int> hon = {2,4,5,7,9};
  vector<int> pon = {0,1,6,8};
  vector<int> bon = {3};
  if(binary_search(hon.begin(),hon.end(),x)){
    result = "hon";
  }
  else if(binary_search(pon.begin(),pon.end(),x)){
    result = "pon";
  }
  else if(binary_search(bon.begin(),bon.end(),x)){
    result = "bon";
  }
  cout << result << endl;

  return 0;
}

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

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   bool a = 1;
   for (auto e : v ) {
      os << (a ? "" : " "); 
      os << e;
      a = 0;
   }
   os << "]";
   return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   os << "(" << p.first << " " << p.second << ")";
   return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
   os << "{";
   bool a = 1;
   for (auto e : mp) {
      os << (a ? "" : " ");
      os << e.first << ":" << e.second;
      a = 0;
   }
   os << "}";
   return os;
}

// std::tuple Debug
template<int N,class Tuple>
void out(ostream &os,const Tuple &t){}
template<int N,class Tuple,class H,class ...Ts>
void out(ostream &os,const Tuple &t){
   if(N)os<<" ";
   os<<get<N>(t);
   out<N+1,Tuple,Ts...>(os,t);
}
template<class ...Ts>
ostream& operator<<(ostream &os, const tuple<Ts...> &t){
   os<<"(";
   out<0,tuple<Ts...>,Ts...>(os,t);
   os<<")";
   return os;
}

// Debug
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

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

   vector<int> v(n), c(n);
   for (int i = 0; i < n; ++i) {
      cin >> v[i];
   }
   for (int i = 0; i < n; ++i) {
      cin >> c[i];
   }

   int ans = 0;
   for (int i = 0; i < n; ++i) {
      ans += max(v[i] - c[i], 0);
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int interest(int a){
	a*=1.05;
	if(a % 1000 != 0){
		a-=a%1000;
		a+=1000;
	}
	return a;
}
	
int main(void){
	int n,debt;
	int i;
	
	debt=100000;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		debt = interest(debt);
	}
	printf("%d\n",debt);
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
struct qiu
{
    int n;
    int h;
    long long count;
};
int main()
{
    int n;
    scanf("%d",&n);
    int a[n];
    int b[n];
    struct qiu c[n];
    for(int i=0;i<n;i++)
    {scanf("%d",&a[i]);b[i]=a[i];}
    sort(b,b+n);
    int d=0;
    long long count2=0;
    c[0].count=0,c[0].n=1,c[0].h=b[0];
    for(int i=1;i<n;i++)
        {
            if(b[i]!=b[i-1])
                {
                    d++;
                    c[d].count=0,c[d].n=1,c[d].h=b[i];
                    count2+=c[d-1].count;
                }
            else
            {

                c[d].count+=c[d].n;
                c[d].n++;
            }
        }
    count2+=c[d].count;
    for(int i=0;i<n;i++)
    {
        int l=0,r=d;
        int flag=1;
        while(l<r)
        {
            int mid=(r+l)/2;
            if(a[i]<c[mid].h)
                r=mid-1;
            else if(a[i]>c[mid].h)
                l=mid+1;
            else
                {printf("%lld\n",count2-c[mid].n+1);flag=0;break;}
        }
        if(flag)
            printf("%lld\n",count2-c[l].n+1);
    }
    return 0;
}



Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

string s;

int main(void){
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5]){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
a,b,h,m = map(int,input().split())
from math import sqrt,cos,radians
the = 30*h-6*m+m/2
kaku = max(the,-the)
if kaku > 180:
    kaku = 360-kaku
    c = a*a + b*b - 2*b*a*cos(radians(kaku))
    print(sqrt(c))
elif kaku == 180:
    print(a+b)  
else:
    c = a*a + b*b - 2*b*a*cos(radians(kaku))
    print(sqrt(c))

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

using namespace std;

int main()
{
   string a;
   string b;
   cin>>a>>b;
   int output=0;
   for(int i=0;i<3;i++){
       if(a[i]==b[i]){output++;}
   }
   cout<<output<<endl;
}


Measured memory_bytes: 384
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    String S[] = new String[H];
    String sharp = "##";
    
    for(int j=0; j<W; j++) {
      sharp += "#";
    }
    System.out.println(sharp);
    
    for(int i=0; i<H; i++) { 
      S[i] ="#" + sc.next() + "#";
      System.out.println(S[i]);
    }
    System.out.println(sharp);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>

int main() {
  int map[21][21];
  int i, j;
  int A, M;
  int x, y;
  int in1, in2;
  char c[2], a;
  int dx, dy;
  int count;
  while(1) {
    scanf("%d", &A);
    if(A == 0) {break;}
    for(i = 0; i < 21; i++) {
      for(j = 0; j < 21; j++) {
	map[i][j] = 0;
      }
    }
    for(i = 0; i < A; i++) {
      scanf("%d %d", &in1, &in2);
      map[in1][in2] = 1;
    }
    scanf("%d", &M);
    count = 0;
    x = 10;
    y = 10;
    if(map[x][y] == 1) {
      map[x][y] = 0;
      count++;
    }
    for(i = 0; i < M; i++) {
      scanf("%s %d", c, &in1);
      if(c[0] == 'N') {
	dx = 0;
	dy = 1;
      }
      if(c[0] == 'S') {
	dx = 0;
	dy = -1;
      }
      if(c[0] == 'W') {
	dx = -1;
	dy = 0;
      }
      if(c[0] == 'E') {
	dx = 1;
	dy = 0;
      }
      for(j = 0; j < in1; j++) {
	x += dx;
	y += dy;
	if(map[x][y] == 1) {
	  map[x][y] = 0;
	  count++;
	}
      }
    }
    if(count == A){
      printf("Yes\n");
    }
    else {
      printf("No\n");
    }
  }
  return 0;
}

Measured memory_bytes: 0
require "prime"
N = gets.to_i
ps = {}
(1..N).each{ |n|
  n.prime_division.each{ |q,d|
    ps[q] ||= 0
    ps[q] += d
  }
}
#p ps

ms = Array.new(77,0)
ms[1] = 1
ps.each{ |q,d|
  mms = Array.new(77,0)
  
  (1..75).each{ |i|
  	(0..d).each{ |j|
      mms[[i*(j+1), 76].min] += ms[i]
    }
  }
  ms = mms
  #p ms
}
p ms[75]



Measured memory_bytes: 2300
#include<bits/stdc++.h>
#define int int64_t
using namespace std;

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

    int n , x , t;
    cin >> n >> x >> t;
    int ans = n/x;
    if(n % x != 0) ans++;
    cout << ans*t << "\n";

    return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
char c[101];
int main() 
{
	int k;
    while(cin>>c[++k]);
    sort(c+1,c+1+k);
    int n=unique(c+1,c+1+k)-c-1;
    n==k ? cout<<"yes"<<endl : cout<<"no"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int A;
    int B;
    cin >> A >> B;
    if((A + 11) % 13 > (B + 11) % 13){
        cout << "Alice" << endl;
    }else if(A == B){
        cout << "Draw" << endl;
    }else{
        cout << "Bob" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        w: u64,
        a: u64,
        b: u64,
    }
    println!("{}",
        if a+w < b {
            b - (a + w)
        } else if b+w < a {
            a - (b + w)
        } else {
            0
        });
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  char a[n][n], b[m][m];
  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (size_t i = 0; i < m; i++) {
    for (size_t j = 0; j < m; j++) {
      cin >> b[i][j];
    }
  }
  bool tf = false;

  if (n==m) {
    bool match = true;
    for (size_t i = 0; i < m and match; i++) {
      for (size_t j = 0; j < m and match; j++) {
        if (b[i][j]!=a[i][j]) match=false;
      }
    }
    if (match) tf = true;
  }
  else {
    for (size_t i = 0; i < n-m and tf == false; i++) {
      for (size_t j = 0; j < n-m and tf == false; j++) {
        bool match = true;
        for (size_t k = 0; k < m; k++) {
          for (size_t l = 0; l < m; l++) {
            if (b[k][l]!=a[i+k][j+l]) {
              match = false;
              break;
            }
          }
        }
        if (match) tf = true;
      }
    }
  }
  if (tf) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
ll K;
ll A[100050];
ll beki[43];
ll digit[43][2];
ll f(int index, bool flag) {
    //if(beki[index] > K) return f(index - 1, true);
    if(index == -1) return 0;
    if(flag) {
        if(!(1 & (K >> index))) {
            return digit[index][1] * beki[index] + f(index - 1, true);
        }
        return max(digit[index][1] * beki[index] + f(index - 1, false), digit[index][0] * beki[index] + f(index - 1, true));
    }
    return max(digit[index][0], digit[index][1]) * beki[index] + f(index - 1, false);
}

int main() {
    //cout.precision(10);
    cin >> N >> K;
    ll sum = 0;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    beki[0] = 1;
    for(int i = 1; i < 42; i++) {
        beki[i] = beki[i - 1] * 2;
    }
    for(int i = 0; i < 42; i++) {
        for(int j = 1; j <= N; j++) {
            if(1 & (A[j] >> i)) digit[i][1]++;
            else digit[i][0]++;
        }
    }
    //cout << max(sum, f(41, true)) << endl;
    cout << max((ll)0, f(41, true)) << endl;
    return 0;
}


Measured memory_bytes: 1024
class Rest
  attr_accessor :name, :point, :num
  def initialize(num, name, point)
    @num = num
    @name = name
    @point = point
  end
end
n = gets.to_i
rests = []
n.times do |i|
  lines = gets.split
  rests.push Rest.new(i+1, lines[0], lines[1].to_i)
end
rests.sort!{|a, b| 
  if a.name != b.name
    a.name <=> b.name
  else
    b.point <=> a.point
  end
}
rests.each do |i|
  puts i.num
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	char a[105],b[105];
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>b[i];
	for(int i=1;i<=n;i++)
	{
		cout<<a[i]<<b[i];
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;


class UnionFind {

    int n;
public:
    vector<int> uni;
    explicit UnionFind(int n) : uni(static_cast<u32>(n), -1) , n(n){};

    int root(int a){
        if (uni[a] < 0) return a;
        else return (uni[a] = root(uni[a]));
    }

    bool unite(int a, int b) {
        a = root(a);
        b = root(b);
        if(a == b) return false;
        if(uni[a] > uni[b]) swap(a, b);
        uni[a] += uni[b];
        uni[b] = a;
        return true;
    }
};

int main() {
    int h, w;
    while(cin >> w >> h, h|w){
        UnionFind uf(h*w);
        int dx[] {1, -1, 0, 0}, dy[] {0, 0, -1, 1};
        vector<vector<int>> v(h+2, vector<int> (w+2, 0));
        int sy = 0, sx = 0;
        for (int i = 0; i < h; ++i) {
            string s;
            cin >> s;
            for (int j = 0; j < w; ++j) {
                if(s[j] == '@') sy = i, sx = j;
                if(s[j] != '#') v[i+1][j+1] = 1;
            }
        }
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                if(v[i+1][j+1] == 0) continue;
                for (int k = 0; k < 4; ++k) {
                    if(v[i+1+dy[k]][j+1+dx[k]]){
                        uf.unite(i*w+j, (i+dy[k])*w+(j+dx[k]));
                    }
                }
            }
        }
        cout << -uf.uni[uf.root(sy*w+sx)] << "\n";
    }
    return 0;
}



Measured memory_bytes: 3052
package main

import (
	"fmt"
	"math"
)

var A, B, H, M float64

func main() {
	fmt.Scan(&A, &B, &H, &M)
	rad := func() float64 {
		return math.Pi * ((2.0 / 720.0 * (60.0*H + M)) - 2.0/60.0*M)
	}
	fmt.Println(math.Sqrt(A*A + B*B - 2*A*B*math.Cos(rad())))
}


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

int mark[15];

string to_s(int n) {
	stringstream ss;
	ss << n;
	return ss.str();
}

int main() {
	int n, k, d;
	cin >> n >> k;
	for(int i = 0; i < k; cin >> d, mark[d]++, i++);

    string num = to_s(n), m;
    for(int i = 0; i < num.size(); i++) {
    	char ch = num[i];
    	m.push_back(ch);
    	if(mark[ch - '0']) {
    		for( ; m.size() > 0 ; ) {
    			bool ok = false;
    			for(int j = m[m.size() - 1] - '0' + 1; j <= 9; j++) {
    				if(!mark[j]) {
    					m[m.size() - 1] = '0' + j;
    					ok = true;
    					break;
    				}
    			}

    			if(ok) break;
    			m.pop_back();
    		}
    		break;
    	}
    }

    n = num.size();
    if(m.size() == 0) n++;
    else n -= m.size(); 
    
    for(int i = 0; i < n; i++) {
    	for(int j = 0; j <= 9; j++) {
    		if(!mark[j]) {
    			if(m.size() == 0 && j == 0) continue;
    			m.push_back('0' + j);
    			break;
    		}
    	}
    }

    cout << m << endl;

    return 0;
}

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

long long n, x;

int main() {
	cin>>n;
	for(long long i=1;i*i<=n;i++)
		if(n%i==0) x = i;
	x = n/x;
	int ans=0;
	while(x) {
		x/=10; ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    multiset<int> s;
    int q; cin >> q;
    rep(i, q){
        int c, x, l ,r;
        cin >> c;
        if(c==0){
            cin >> x;
            s.insert(x);
            pr(s.size());
        }else if(c==1){
            cin >> x;
            pr(s.count(x));
        }else if(c==2){
            cin >> x;
            s.erase(x);
        }else{
            cin >> l >> r;
            if(l<=r){
                auto li = s.lower_bound(l);
                auto ri = s.upper_bound(r);
                for(; li!=ri; li++) pr(*li);
                // if(*li==r) pr(*li);
            }
        }
    }
    return 0;}


Measured memory_bytes: 12344
K = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[K-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll h;
  cin >> h;
  ll ans = 0;
  ll cnt = 1;
  while(h>0) {
    ans += cnt;
    h /= 2;
    cnt *= 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
def odd(x):
    if (x-1)%2 == 0:
        return True
    else:
        return False


N = input()
index, num = len(N), int(N)

ans = 0
for i in range(1, index+1):
    if odd(i):
        if num >= 10**i:
            ans = ans + (10**i - 10**(i-1))
            
        else:
            ans = ans + (num - 10**(i-1) + 1)
            
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
ll const mod=998244353;
const ll MAX=300000;
using vi=vector<int>;
using vc=vector<char>;
using vs=vector<string>;
using vvi =vector<vector<int>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
int main(){
    char c;
    cin>>c;
    cout<<(char)(c+1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define float long double 

float dou(int a, int b)
{
  int c = a*a + b*b;
  return sqrt(c);
}

int32_t main()
{
  IOS;
  int n,d;
  cin>>n>>d;
  float dist[n]={0.0};
  for(int i=0; i<n; i++)
  {
    int a,b;
    cin>>a>>b;
    float dm = dou(a,b);
    dist[i] = dm;
  }

  int cnt = 0;
  for(int i=0; i<n; i++)
  {
    if(dist[i]<=d)
    cnt++;
  }
  cout<<cnt<<endl;

  return 0;
}

Measured memory_bytes: 6820
@S=(1)x(@p=@i=0..10**5);$\-=<>;sub f{my$U=pop;$p[$U]=$U-$p[$U]?f($p[$U]):$U}/ />${*a=-$'}||(($u=f$a)-($v=f$`)and$S[$p[$v]=$u]+=$S[$v]),$a=$`for<>;$\+=${*u=-$_}>0&&$S[f$u]for@i;print

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

using namespace std;

#define long long long
#define INF ((long) 1e18)
#define MOD 998244353
#define mll map<long, long>
#define pll pair<long, long>
#define pb push_back
#define FOR(i, a, b) \
  for (long i = (a); i < (long) (b); i++)
#define PRINTV(v) \
  FOR (_i, 0, v.size()) \
    cout << v[_i] << " "; \
  cout << "\n";

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

  long n;
  cin >> n;

  multiset<pll> left, right, a, b;
  FOR (i, 0, n) {
    long l, r;
    cin >> l >> r;
    left.insert({l, r});
    right.insert({r, l});
  }
  long total = 0;
  a = left, b = right;
  long x0 = 0;
  bool t = true;
  while (not left.empty()) {
    long x;
    if (t) {
      auto it = right.begin();
      x = it->first;
      if (x > x0) x = max(x0, it->second);
      left.erase(left.find({it->second, it->first}));
      right.erase(it);
    } else {
      auto it = left.end();
      it--;
      x = it->first;
      if (x < x0) x = min(x0, it->second);
      right.erase(right.find({it->second, it->first}));
      left.erase(it);
    }
    total += abs(x - x0);
    x0 = x;
    t = not t;
  }
  total += abs(x0);
  long maximo = total;
  total = 0;
  left = a;
  right = b;
  t = false;
  x0 = 0;
  while (not left.empty()) {
    long x;
    if (t) {
      auto it = right.begin();
      x = it->first;
      if (x > x0) x = max(x0, it->second);
      left.erase(left.find({it->second, it->first}));
      right.erase(it);
    } else {
      auto it = left.end();
      it--;
      x = it->first;
      if (x < x0) x = min(x0, it->second);
      right.erase(right.find({it->second, it->first}));
      left.erase(it);
    }
    total += abs(x - x0);
    x0 = x;
    t = not t;
  }
  total += abs(x0);
  maximo = max(maximo, total);
  printf("%lld\n", maximo);
}


Measured memory_bytes: 27264
import java.util.Scanner

object Main extends App { 
  val sc = new Scanner(System.in)
  val N, M = sc.nextInt()
  val coins = (for (i <- 1 to M) yield sc.nextInt).toList
  val inf = Int.MaxValue >> 1

  class DP(n:Int, coins:List[Int]) {
    val memo:Array[Int] = Array.fill(n+1)(inf)
    memo.update(0, 0)

    def solver():Int = {
      for (c <- coins; i <- 1 to n) {
        if (i < c) memo(i)
        else memo.update(i, (memo(i) min (memo(i-c)+1)))
      }
      memo(n)
    }
  }
  
  val dp = new DP(N, coins)

  println(dp.solver())

}


Measured memory_bytes: 63420
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz(x) (int)x.size()
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	string s;
	cin>>s;
	if(s[sz(s)-1] == 's')
	s += "es";
	else s += 's';
	cout<<s<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
   while(1){
      int n;
      cin >> n;
      if(n==-1){
         break;
      }
      vector<int> seg = {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
      vector<int> vec(n+1);
      vec[0] = 0b0000000;
      for(int i=1;i<n+1;i++){
         cin >> vec[i];
         vec[i] = seg[vec[i]];
      }
      for(int i=0;i<n;i++){
         cout << bitset<7>(vec[i]^vec[i+1]) << endl;
      }
   }

}


Measured memory_bytes: 3132
using System;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;

namespace Tutorial
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            int match = 0;

            for (var i = 0; i < s1.Length; i++)
            {
                if (s1[i] != s2[i])
                {
                    match++;
                }
            }
            Console.WriteLine(match);
        }
    }
}


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

vector<int> memo[1000005];
int cnt[1000005];
int arr[1000005];

bool isPrime[1000005];
void sieve1(int N)
{
	for(int i = 2; i <= 1000000; i++)
		isPrime[i] = true;
		
	for(int i = 2; i * i <= 1000000; i++)
	{
		if(isPrime[i])
		{
			//printf("i = %d\n", i);
			for(int j = i * i; j <= 1000000; j += i)
				isPrime[j] = false;
		}
	}
}

void sieve(int N)
{
	for(int i = 2; i <= 1000000; i++)
	{
		if(isPrime[i])
		{
			int idx = lower_bound(arr + 1, arr + N + 1, i) - arr, idx3 = upper_bound(arr + 1, arr + N + 1, i) - arr;
			
			cnt[i] += (idx3 - idx);
					
			memo[i].push_back(i);
			
			if(i > 1000)
				continue;
			
			for(int j = i * i; j <= 1000000; j += i)
			{
				int idx1 = lower_bound(arr + 1, arr + N + 1, j) - arr, idx2 = upper_bound(arr + 1, arr + N + 1, j) - arr;
				
				if(isPrime[i])
				{
					cnt[i] += (idx2 - idx1);
				}
				
				if(j / i != i && isPrime[j / i])
					cnt[j / i] += (idx2 - idx1);
					
				memo[j].push_back(i);
			}
		}
	}
	
	
}


bool isPairwise()
{
	for(int i = 2; i <= 1000000; i++)
	{
		if(cnt[i] >= 2)
			return false;
	}
	
	return true;
}

int main()
{
	int N;
	scanf("%d", &N);
	
	int GCD = -1;
	for(int i = 1; i <= N; i++)
	{
		int num;
		scanf("%d", &num);
		arr[i] = num;
		
		if(GCD == -1)
			GCD = num;
			
		else
			GCD = __gcd(GCD, num);
	}
	sort(arr + 1, arr + N + 1);
	
	sieve1(N);
	sieve(N);
	
	if(isPairwise())
		printf("pairwise coprime");
		
	else if(GCD == 1)
		printf("setwise coprime");
		
	else
		printf("not coprime");
}


Measured memory_bytes: 67816
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007 ;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
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;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int a,b,i;cin>>a>>b;
	if(a>b){swap(a,b);}
	REP(i,b){cout<<a;}cout<<endl;
}

Measured memory_bytes: 888
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  return Math.floor(N / 3);
};

console.log(main(read()));


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

using namespace std;

int main() {
int a, b;
cin >> a >> b;
if (a <= 0 && 0 <= b)
cout << "Zero";
else {
if (a > 0)
cout << "Positive";
else {
int cnt = b - a + 1;
if (cnt % 2)
cout << "Negative";
else
cout << "Positive";
}
}
}

Measured memory_bytes: 256
from sys import stdin

def main():
    n,m = map(int,stdin.readline().split())
    ans = ""
    if n<m:
        x = str(n)
        for i in range(m):
            ans += x
    else:
        x = str(m)
        for i in range(n):
            ans += x
    print(ans)
main()


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int v = max(a, max(b, c));
	cout << a + b + c - max(a, max(b, c)) + v * pow(2, k) << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	int k=0, ans=0;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='R'){
			k++;
		}else{
			ans = max(ans, k);
			k=0;
		}
	}
	ans = max(ans, k);
	cout << ans;
}





Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD (ll) (1e9+7)
int main()
{
	string s;
	cin>>s;
	if(s[s.size()-1] !='s')
	{
		s+='s';
	}
	else if(s[s.size()-1] =='s')
	{
		s+="es";
	}
	cout<<s<<"\n";
}

Measured memory_bytes: 3624
ans =[1,2,3,4,5,6,7,8,9,10,11,12,13,1,14,2,15,3,16,4,17,5,18,6,19,7,20,8,21,9,22,10,23,11,24,12,25,13,26]*20

for i in range(365):
    print(ans[i])

Measured memory_bytes: 9100
N, M = map(int, input().split())
L_max, R_min = 0, 100000
for i in range(M):
  L, R = map(int,input().split())
  if L_max < L:
    L_max = L
  if R_min > R:
    R_min = R
if R_min - L_max < 0:
  print(0)
else:
  print(R_min - L_max + 1)

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int const MAX_N = 100010;
vector<ll> prime;
vector<bool> is_prime(MAX_N,true);
void Eratosthenes() {
    is_prime[0] = is_prime[1] = false;
    for (ll i = 2;i*i < MAX_N;++i) if (is_prime[i]) for (ll j = 2*i;j < MAX_N;j += i) is_prime[j] = false;
    for (ll i = 0;i < MAX_N;++i) if (is_prime[i]) prime.push_back(i);
}

int main() {
    int n;
    cin >> n;
    Eratosthenes();
    cout << *lower_bound(prime.begin(),prime.end(),n) << endl;
}

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 1e5 )+10;
const int MOD  = int( 360 );
const int oo   = INT_MAX;
const lf EPS = 1e-9;

struct pt {
  lf x, y;
  pt( ) { }
  pt( lf x, lf y ) : x( x ), y ( y ) { }
};

inline lf x( pt P ) { return P.x; }
inline lf y( pt P ) { return P.y; }

istream& operator >> ( istream& in, pt& p ) {
  lf x,y; in >> x >> y;
  p = pt(x,y); return in;
}

ostream& operator << ( ostream& out, const pt& p ) {
  out << double(p.x) << " " << double(p.y);
  return out;
}

pt operator + ( const pt& A, const pt& B ) {
  return pt( x(A)+x(B), y(A)+y(B) );
}

pt operator - ( const pt& A, const pt& B ) {
  return pt( x(A)-x(B), y(A)-y(B) );
}

pt operator * ( const lf& B, const pt& A ) {
  return pt( x(A)*B, y(A)*B );
}

pt operator * ( const pt& A, const lf& B ) {
  return pt( x(A)*B, y(A)*B  );
}

inline lf norm( pt A ) {
  return x(A)*x(A) + y(A)*y(A);
}

inline lf abs( pt A ) {
  return sqrt( norm(A) );
}

inline bool same ( lf a, lf b ) {
  return a+EPS > b && b+EPS > a;
}

inline lf dist ( pt A, pt B ) { return abs( B - A ); }

int n;
pt P[ MAXN ], extra[ MAXN ];

bool cmpX( const pt &A, const pt &B ) {
  return A.x < B.x;
}

void merge( int f, int m, int t ){
	int total = t - f + 1;
	for( int i = 0, l = f, r = m+1; i < total; ++i ){
		if( l == m+1 ){
      extra[ i ] = P[ r++ ];
		}
		else if( r == t+1 ){
		  extra[ i ] = P[ l++ ];
		}
		else if( P[l].y < P[r].y ){
		  extra[ i ] = P[ l++ ];
		}
		else{
		  extra[ i ] = P[ r++ ];
		}
	}
	for( int i = 0; i < total; ++i ){
    P[ f+i ] = extra[ i ];
	}
}

lf solve( int f, int t ) {
  if( f == t ) return oo;
	int mi = (f + t)/2;
	lf mx = P[ mi ].x;
	lf d = min( solve( f, mi ), solve( mi+1, t ) );
	merge( f, mi, t );
	vector< int > idxs;
	for( int i = f; i <= t; ++i ){
		if( fabs(mx - P[i].x) < d ) idxs.push_back( i );
	}
	for( int i = 0; i < idxs.size(); ++i ){
		for( int j = i+1; j < idxs.size() && fabs(P[ idxs[i] ].y - P[ idxs[j] ].y) < d; ++j ){
			d = min( d, dist( P[ idxs[i] ], P[ idxs[j] ] ) );
		}
	}
	return d;
}

int main( ) {

  #ifdef LOCAL
    freopen( "CGL_5_A-in25.txt", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif
  cout << fixed << setprecision( 10 );
  cin >> n;
  for( int i = 0; i < n; ++i ) {
    cin >> P[i];
  }
  sort( P, P+n, cmpX );
  cout << double( solve( 0, n-1 ) ) << '\n';
  return 0;
}

Measured memory_bytes: 9532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const int lmod = 1000000007;
inline pll inv(pll p)
{
	if(p.first==0)
		return pll(1,0);
	if(p.second==0)
		return pll(0,1);
	return pll(p.second,-p.first);
}
ll modpow(ll a, ll b)
{
	if(b==0)
		return 1;
	ll f = modpow(a,b/2);
	f = (f*f)%lmod;
	if(b&1)
		f=(f*a)%lmod;
	return f;
}
ll gcd(ll a, ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<pll> v(n);
	map<pll, vector<pll>> m1,m2;
	pll p;
	ll vv=0;
	for(auto& p:v)
	{
		cin>>p.first>>p.second;
		if(p.first==0 && p.second==0)
		{
			vv++;
			continue;
		}
		if(p.first==0)
		{
			m2[pll(0,1)].push_back(p);
			continue;
		}
		if(p.second==0)
		{
			m1[pll(1,0)].push_back(p);
			continue;
		}
		if(p.first<0)
		{
			p.first*=-1;
			p.second*=-1;
		}
		if(p.second>0)
		{
			ll g = __gcd(abs(p.first),abs(p.second));
			auto q = pll(p.first/g,p.second/g);
			m1[q].push_back(p);
		}
		else
		{
			ll g = __gcd(abs(p.first),abs(p.second));
			auto q = pll(p.first/g,p.second/g);
			m2[q].push_back(p);
		}
	}
	ll ans=1;
	for(auto& it:m1)
	{
		p = it.first;
		ll mul = modpow(2,(it.second).size());
		auto q = inv(p);
		if(m2.find(q)!=m2.end())
		{
			mul = mul + modpow(2,m2[q].size()) - 1;
			m2.erase(q);
		}
		mul%=lmod;
		ans = ans*mul;
		ans%=lmod;
	}
	for(auto& it:m2)
	{
		ll mul = modpow(2,(it.second).size());
		ans = ans*mul;
		ans%=lmod;
	}
	ans = (ans+vv)%lmod;
	ans = (ans-1)%lmod;
	if(ans<0)
		ans+=lmod;
	cout<<ans<<"\n";
}

Measured memory_bytes: 28196