akhauriyash/Code-Regression huggingface dataset:
n = int(input())
s = list(input())

ruisekiwa = [0]
ans = n

for i in s:
    if i == "W":
        ruisekiwa.append(ruisekiwa[-1]+1)
    else:
        ruisekiwa.append(ruisekiwa[-1])
        
for i in range(1,n+1):
    w = ruisekiwa[i-1]
    e = n-i-(ruisekiwa[-1]-ruisekiwa[i])
    ans = min(ans,w+e)
    
print(ans)    

Measured memory_bytes: 19456
#include<bits/stdc++.h>
using namespace std;
int n,res=0,sum=0;
string s;
vector<pair<int,int> >v;
bool cmp(pair<int,int>p1,pair<int,int>p2) {return min(p1.second,p1.first+p2.second)>min(p2.second,p2.first+p1.second);}
main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        int cnt=0,mn=0;
        for(char c:s) c=='('?cnt++:cnt--,mn=min(mn,cnt);
        v.emplace_back(cnt,mn);
        sum+=cnt;
    }
    if(sum!=0) {puts("No");exit(0);}
    sort(v.begin(),v.end(),cmp);
    for(pair<int,int>p:v){
        if(res<-p.second){
            puts("No");exit(0);
        }
        res+=p.first;
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 11632
#include <iostream>
using namespace std;
int main() {
	string a, b, c;
	cin >> a >> b >> c;
	string ans;
	if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
		ans = "YES";
	}else{
		ans = "NO";
	}
	cout << ans << endl;
	return 0;
}

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

#include <unordered_map>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <sstream>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll pow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = pow(N, P/2);
        return t*t;
    }
    return N * pow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    n=abs(n);
    m=abs(m);
    if(n*m==0)return max(n,m);
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
int main() {
    int k,a,b;cin>>k>>a>>b;
    rep(i,1000){
        if((a<=i*k)&&(i*k<=b)){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int ans[505][505];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int mm=0;
    int curr=n-1;
    while(curr) {
        mm++;
        curr/=2;
    }

    int i,j,k;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            ans[i][j]=-1;
        }
    }
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            if(ans[i][j]>=0) continue;
            for(k=0; k<mm; k++) {
                if((i&(1<<k))!=(j&(1<<k))) {
                    ans[i][j]=k;
                }
            }
        }
    }

    for(i=0; i<n; i++) {
        for(j=i+1; j<n; j++) {
            printf("%d ", ans[i][j]+1);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 1408
#include <iostream>

int gcd(int a, int b){
    int remainder;
    while((remainder = (a % b)) != 0) {
        a = b;
        b = remainder;
    }
    return b;
}

int lcm(int a, int b){
    return ((a / gcd(a, b)) * b);
}

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
    }
    return 0;
}

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n ;
	cin>> n ;
	string s;
	cin>> s;
	string search = "ABC";
	int ans = 0;
	rep(i,n-2){
		string t = s.substr(i,3);
		if(search==t){
			ans ++ ;
		}
	}
	cout << ans << endl;

	
}


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

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

    for (int i = 10; i < 1010; i++) {
        if (8*i/100 == a && i/10 == b) {
            cout << i << endl;
            return 0;
        }
    }
    
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   string s;
           cin>>s;
           int n=s.size();
           int cnt=0;
           rep(i,0,n){
            if(s[i]>='a'&&s[i]<='z'){
             cnt++;
              cout<<s[i];
            }
             if(cnt==3){
              cout<<endl;
               return 0;
             }
           }
}

Measured memory_bytes: 3576
import java.util.*

private fun readStrings() = readLine()!!.split(" ")
private fun readInts() = readStrings().map { it.toInt() }

fun main(args: Array<String>) {
    val N = readInts()[0]
    val p = (1 .. N).map { readInts()[0] }

    val series = HashMap<Int, Int>()
    p.forEach {
        if (series.containsKey(it - 1)) {
            series[it] = series.remove(it - 1)!! + 1
        } else {
            series[it] = 1
        }
    }
    println(N - series.values.max()!!)
}

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    for(int i = 0; i < s.size(); ++i)
    {
        if(n + s[i] > 'Z'){
            s[i] = n + s[i] - 'Z' - 1 + 'A';
            continue;
        }
        s[i] = s[i] + n;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
from fractions import gcd
N, K = map(int, input().split())
a = list(map(int, input().split()))
t = 0
if max(a) < K:
  print("IMPOSSIBLE")
  exit(0)
for i in range(N):
  t = gcd(t, a[i])
if K % t:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")

Measured memory_bytes: 88428
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//------------------------------------------
//------------------------------------------

int main() {

    string s, t;
    cin >> s >> t;

    vector<int> cnt_s(26, 0);
    vector<int> cnt_t(26, 0);

    for (auto c: s) cnt_s[c - 'a']++;
    for (auto c: t) cnt_t[c - 'a']++;

    for (int i = 0; i < 26; i++) {
        if (cnt_t[i] != 0 && cnt_s[i] == 0) {
            cout << -1 << endl;
            return 0;
        }
    }

    unordered_map<char, LL> mp;
    for (int i = s.size() - 1; i >= 0; i--) {
        mp[s[i]] = i + s.size();
    }

    vector<unordered_map<char, LL>> arr(s.size());
    for (int i = s.size() - 1; i >= 0; i--) {
        arr[i] = mp;
        mp[s[i]] = i;
    }

    LL pos = -1;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == t[0]) {
            pos = i;
            break;
        }
    }

    for (int i = 1; i < t.size(); i++) {
        char c = t[i];
        LL d = pos % s.size();
        pos += arr[d][c] - d;
    }

    cout << pos + 1 << endl;

}
























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

int n;
char buf[114514];

string C(string s) {
  return s.substr(1) + s[0];
}

string J(string s) {
  int k = s.length()-1;
  return s[k] + s.substr(0, k);
}

string E(string s) {
  int n = s.length();
  if (n%2 == 1) {
    return s.substr(n/2+1) + s[n/2] + s.substr(0, n/2);
  }
  return s.substr(n/2) + s.substr(0, n/2);
}

string A(string s) {
  reverse(s.begin(), s.end());
  return s;
}

string M(string s) {
  int n = s.length();
  for (int i=0; i<n; i++) {
    char c = s[i];
    if ('0' <= c && c <= '9') s[i] = '0' + (c-'0'+1)%10;
  }
  return s;
}

string P(string s) {
  int n = s.length();
  for (int i=0; i<n; i++) {
    char c = s[i];
    if ('0' <= c && c <= '9') s[i] = '0' + (c-'0'+9)%10;
  }
  return s;
}

int main() {
  scanf("%d", &n);
  while (n--) {
    scanf(" %s", buf);
    string order(buf);
    scanf(" %s", buf);
    string msg(buf);

    reverse(order.begin(), order.end());
    for (int i=0; i<order.size(); i++) {
      if (order[i] == 'A') msg = A(msg);
      if (order[i] == 'J') msg = J(msg);
      if (order[i] == 'E') msg = E(msg);
      if (order[i] == 'P') msg = P(msg);
      if (order[i] == 'M') msg = M(msg);
      if (order[i] == 'C') msg = C(msg);
    }

    printf("%s\n", msg.c_str());
  }
}

Measured memory_bytes: 3128
n, m, L = map(int, input().split())

a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
c = [[sum(ak * bk for ak, bk in zip(ai,bj)) for bj in zip(*b)] for ai in a]

for ci in c:
    print(*ci)

Measured memory_bytes: 7768
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;
int main(){
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int pat1,pat2,pat3;
  pat1 = a*x+b*y;
  if(x>y)  pat2 = c*2*y+(x-y)*a;
  else pat2 = c*2*x+(y-x)*b;
  if(x>y) pat3 = x*2*c;
  else pat3 = y*2*c;
  int m = min({pat1,pat2,pat3});
  cout << m << "\n";
  return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  
  bool ok = false;
  for(int i = 1; i < 5000; i++){
    int x = i*8/100;
    int y = i*10/100;
    if(x == a && y == b){
      ok = true;
      cout << i << endl;
      break;
    }
  }
  
  if(ok == false) cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(void) {

	int n;
	int p[200000];
	int c = 0;
	int min = 1000000000;

	bool notBig = true;

	scanf("%d", &n);

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

	for (int i = 0; i < n; i++) {
		if (p[i] <= min) {
			c++;
			min = p[i];
		}
	}

	printf("%d\n", c);

	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),k=nxt(),r=nxt(),s=nxt(),p=nxt();
    string t;
    cin>>t;
    vector <char> chosen(n);
    int test=0;
    for(int i=0;i<k;i++)
    {
        if(t[i]=='r')
        {
            chosen[i]='p';
            test+=p;
        }
        else if(t[i]=='s')
        {
            chosen[i]='r';
            test+=r;
        }
        else
        {
            chosen[i]='s';
            test+=s;
        }

    }
    for(int i=k;i<n;i++)
    {chosen[i]='-';
        if(t[i]=='r'&&chosen[i-k]!='p')
        {
            
             chosen[i]='p';
            test+=p;
            
            
        }
        else if(t[i]=='s'&&chosen[i-k]!='r')
        {
            chosen[i]='r';
            test+=r;
        }
        else if(t[i]=='p'&&chosen[i-k]!='s')
        {
            chosen[i]='s';
            test+=s;
        }
    }
    cout<<test<<endl;
    

    return 0;   
}


 
 


Measured memory_bytes: 512
#include <stdio.h>

typedef struct _r {
    int first;
    int last;
} Range;

int main() {
    int w, h, n;
    scanf("%d %d %d", &w, &h, &n);

    Range xr;
    xr.first = 0;
    xr.last = w;
    Range yr;
    yr.first = 0;
    yr.last = h;

    for (int i = 0; i < n; i++) {
        int x, y, a;
        scanf("%d %d %d", &x, &y, &a);
        switch (a) {
        case 1: // x < xi
            if (x > xr.first) {
                xr.first = x;
            }
            break;
        case 2: // x > xi
            if (x < xr.last) {
                xr.last = x;
            }
            break;
        case 3: // y < yi
            if (y > yr.first) {
                yr.first = y;
            }
            break;
        case 4: // y > yi
            if (y < yr.last) {
                yr.last = y;
            }
            break;
        }
    }

    if ((xr.last - xr.first) < 0 || (yr.last - yr.first) < 0) {
        printf("0\n");
        return 0;
    }

    printf("%d\n", (xr.last - xr.first) * (yr.last - yr.first));

    return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int N, K;
    cin >> N >> K;
    
    int answer = K;
    for (int i = 0; i < N - 1; i++) answer *= K - 1;
    
    cout << answer << endl;
    
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

 vl a;
 vl b;
 vl c;
 vl ab;
 ll n;
 ll ans = 0;

int main(){
  cin >> n;
  a = vl(n);
  b = vl(n);
  c = vl(n);
  for(ll i = 0;i < n;i++) cin >> a[i];
  for(ll i = 0;i < n;i++) cin >> b[i];
  for(ll i = 0;i < n;i++) cin >> c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  ab = vl(n+1);
  for(ll i = 0,j = 0;i < n;i++){
    while(j < n && a[j] < b[i]) j++;
    ab[i+1] = j;
  }
  for(ll i = 1;i <= n;i++) ab[i] += ab[i-1];
  for(ll i = 0,j = 0;i < n;i++){
    while(j < n && b[j] < c[i]) j++;
    ans += ab[j];

  }
  cout << ans << endl;

}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;
const int mod = 1000000007;

int main(){
  int h, w, k;
  cin >> h >> w >> k;
  vector<vector<int> > dp(h + 1, vector<int>(w, 0));
  dp[0][0] = 1;
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      for (int k = 0; k < (1 << (w - 1)); k++){
        bool ok = true;
        for (int l = 0; l < w - 2; l++){
          if (((k >> l) & 1) && ((k >> (l + 1)) & 1))
            ok = false;
        }
        if (ok){
          if (j >= 1  && ((k >> (j - 1)) & 1)){
            dp[i + 1][j - 1] += dp[i][j];
            dp[i + 1][j - 1] %= mod;
          }
          else if (j < w - 1 && ((k >> j) & 1)){
            dp[i + 1][j + 1] += dp[i][j];
            dp[i + 1][j + 1] %= mod;
          }
          else{
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= mod;
          }
        }
      }
    }
  }
  cout << dp[h][k - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
//https://blog.csdn.net/hesorchen
// #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define mem(a, b) memset(a, b, sizeof(a))
#define lowbit(a) (a & (-a))
#define mod 1000000007
#define endl "\n"
ll zuhe(ll n, ll m)
{
    ll a = 1, b = 1;
    for (int i = n; i > n - m; i--)
        a *= i;
    for (int i = 1; i <= m; i++)
        b *= i;
    return a / b;
}
ll p[100] = {1, 5, 17, 49, 129, 321, 769, 1793, 4097, 9217, 20481, 45057, 98305, 212993, 458753, 983041, 2097153, 4456449, 9437185, 19919791, 40934240, 85635360, 162200853, 329314625, 434219937, 1001996852, 1649979779, 3139896570, 2514876211, 6265438914, 9491293469, 13540317595, 20548233969, 33446368715, 15048064581, 40189067607, 40811498685, 59399120025, 96275183197, 129030690842, 168010512548, 262738143190, -101495838273, 18277894373, 197031734518, 401760972831, 226207130411, 540955206077, 548189037620, 665107065036, 947089322773, 950871050259, 1188398367837, 1681173095220, 2091832350787, 2491879393861, 2921490344108};

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll temp = __gcd(c, d);
    temp = c * d / __gcd(c, d);
    ll ca = a, cb = b;
    a--;
    // cout << temp << endl;
    ll s1 = 0, s2 = 0, s3 = 0, s4 = 0;
    s1 = cb - ca + 1;
    s2 = b / c - a / c;
    s3 = b / d - a / d;
    s4 = b / temp - a / temp;
    // printf("%lld %lld %lld %lld\n", s1, s2, s3, s4);
    cout << s1 - s2 - s3 + s4 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
		char w;
		cin>>w;
		if(w=='S')
		{
			cin>>w;
			if(w=='S')
			{
				cin>>w;
				if(w=='S')
				{
					cout<<0;
					return 0;
				}
				else
				{
					cout<<1;
					return 0;
				}
			}
			else
			{
				cin>>w;
				if(w=='S')
				{
					cout<<1;
					return 0;
				}
				else
				{
					cout<<2;
					return 0;
				}
			}
		}
		else
		{
			cin>>w;
			if(w=='S')
			{
				cin>>w;
				if(w=='S')
				{
					cout<<1;
					return 0;
				}
				else
				{
					cout<<1;
					return 0;
				}
			}
			else
			{
				cin>>w;
				if(w=='S')
				{
					cout<<2;
					return 0;
				}
				else
				{
					cout<<3;
					return 0;
				}
			}
		}
	
}

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

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

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }






        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var nm = Reads();
            var n = nm[0];
            var m = nm[1];
            Console.WriteLine(m * 1900 * (long)Math.Pow(2, m) + (n - m) * 100 * (long)Math.Pow(2, m));
            
            Console.WriteLine();
         
            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13396
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define mod   998244353
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define endl "\n"
    #define pii pair<ll,ll>
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

/**********************************************************************************************************************/
string longestRepeatedSubstring(string str) 
{ 
    int n = str.length(); 
    int LCSRe[n+1][n+1]; 
  
    // Setting all to 0 
    memset(LCSRe, 0, sizeof(LCSRe)); 
  
    string res; // To store result 
    int res_length  = 0; // To store length of result 
  
    // building table in bottom-up manner 
    int i, index = 0; 
    for (i=1; i<=n; i++) 
    { 
        for (int j=i+1; j<=n; j++) 
        { 
            // (j-i) > LCSRe[i-1][j-1] to remove 
            // overlapping 
            if (str[i-1] == str[j-1] && 
                LCSRe[i-1][j-1] < (j - i)) 
            { 
                LCSRe[i][j] = LCSRe[i-1][j-1] + 1; 
  
                // updating maximum length of the 
                // substring and updating the finishing 
                // index of the suffix 
                if (LCSRe[i][j] > res_length) 
                { 
                    res_length = LCSRe[i][j]; 
                    index = max(i, index); 
                } 
            } 
            else
                LCSRe[i][j] = 0; 
        } 
    } 
  
    // If we have non-empty result, then insert all 
    // characters from first character to last 
    // character of string 
    if (res_length > 0) 
        for (i = index - res_length + 1; i <= index; i++) 
            res.push_back(str[i-1]); 
  
    return res; 
} 
signed main()/*Check flow...question galat mat padhna */
{
    fast;   
    ll n;
    cin>>n;
    string s;
    cin>>s;
    string x=longestRepeatedSubstring(s);
    cout<<x.length()<<endl;
}      

Measured memory_bytes: 195712
from collections import deque

while True:
  W, H = map(int, input().split())
  if (W,H) == (0,0):
    exit()
  
  # 隣接リストを作る
  adj = [[] for _ in range(W*H)]
  colWall = [None] * H
  rowWall = [None] * (H-1)
  
  for i in range(H):
    colWall[i] = list(map(int, input().split()))
    if i < H-1:
      rowWall[i] = list(map(int, input().split()))
    
  dx = [-1,1,0,0]
  dy = [0,0,-1,1]
  
  for i in range(H):
    for j in range(W):
      for k in range(4):
        y = i + dy[k]
        x = j + dx[k]
        if 0<=x<W and 0<=y<H:
          if k == 0:# 左との比較
            if colWall[i][j-1] == 0:
              adj[W*i+j].append(W*y+x)
          elif k == 1:# 右との比較
            if colWall[i][j] == 0:
              # print(i,j,y,x,colWall)
              adj[W*i+j].append(W*y+x)
          elif k == 2:
            if rowWall[i-1][j] == 0:# 上との比較
              adj[W*i+j].append(W*y+x)
          else:# 下との比較
            if rowWall[i][j] == 0:
              # print(i,j,y,x,rowWall)
              adj[W*i+j].append(W*y+x)
  # print(adj)
  
  queue = deque([0])
  visit = [0] * (W*H)
  visit[0] = 1
  
  while queue:
    now = queue.popleft()
    for u in adj[now]:
      if visit[u] < 1:
        queue.append(u)
        visit[u] = visit[now] + 1
  print(visit[W*H-1])


Measured memory_bytes: 6240
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
#include<typeinfo>
using namespace std;

const double pi=4*atan(1.0);

constexpr long long mod=static_cast<long long>(1e9+7);

using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;

int main() {
	int N;
	cin>>N;
	vector<int> a(N);
	for(auto& val:a){
		cin>>val;
		--val;
	}
	
	int ans=0;
	for(int i=0;i<N;++i){
		if(i==a[a[i]])++ans;
	}

	cout<<ans/2<<endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

//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
int main(){
  int k;
  scanf("%d", &k);
  if (k == 4 || k == 6 || k == 9 || k == 10 || k == 14 || k == 21 || k == 22 || k == 25 || k == 26) {
    puts("2");
  } else if (k == 28 || k == 30) {
    puts("4");
  } else if (k == 8 || k == 12 || k == 18 || k == 20 || k == 27) {
    puts("5");
  } else if (k == 16) {
    puts("14");
  } else if(k == 24){
    puts("15");
  } else if(k == 32){
    puts("51");
  } else {
    puts("1");
  }
  return 0;
}


Measured memory_bytes: 128
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    if(n==m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define rep(i,j,k) for (i=j;i<=k;i++)
using namespace std;
const int N=2e5+5;
int n,i,j,l,r,fl,mid,pos,a[N],b[N],c[N];
bool judge()
{
	int i,l,r,fix;
	rep(i,1,n) b[i]=(a[i]>=mid);
	b[0]=b[1]; b[n+1]=b[n];
	rep(i,1,n) c[i]=!(b[i]!=b[i-1] && b[i]!=b[i+1]);
	if (c[pos]) return b[pos];
	for (l=pos;!c[l];l--);
	for (r=pos;!c[r];r++);
	fix=min(pos-l,r-pos);
	if (fix>=fl-1) return b[pos]^!(fl&1);
	if (pos-l<r-pos) return b[l];
	return b[r];
}
int main()
{
//	freopen("pyramid.in","r",stdin);
//	freopen("pyramid.out","w",stdout);
	scanf("%d",&fl); n=fl*2-1; pos=fl;
	rep(i,1,n) scanf("%d",&a[i]);
	l=1; r=n;
	while (l<r)
	{
		if (r-l>1) mid=(l+r)>>1;
		else mid=r;
		if (judge()) l=mid;
		else r=mid-1;
	}
	printf("%d\n",l);
	return 0;
}

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

int main(void){

  char s[5];
  scanf("%s", s);
  int count = 0;

  for(int i= 0; i<3;i++){
 	if(s[i]==s[i+1]){
      printf("Bad\n");
      return 0;
    }
  }

  printf("Good\n");
  
  return 0;
}

  

Measured memory_bytes: 1640
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
As = sorted(A)
num = 0
i = 0
while i < N:
    count = 0
    j = As[i]
    while i < N and As[i] == j:
        count += 1
        i += 1
    if count % 2 == 1:
        num += 1
print(num)

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

// #undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll dp[3002][3002];

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  string s, t;
  cin >> s;
  cin >> t;
  // dump(s, t);
  int i, j;
  string ans = "";
  // s += "#";
  // t += "$";
  for (i = 0; i < s.size(); i++) {
    for (j = 0; j < t.size(); j++) {
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
      }
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
      // dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      // dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
    }
  }
  // dumpv(dp, s.size() + 1, t.size() + 1);
  // i = s.size() - 1;
  // j = t.size() - 1;
  i = s.size();
  j = t.size();
  // while (i + j) {
  while (0 < i && 0 < j) {
    if (0 < i && dp[i][j] == dp[i - 1][j]) {
      i--;
    } else if (0 < j && dp[i][j] == dp[i][j - 1]) {
      j--;
    } else {
      i--;
      j--;
      ans += s[i];
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
int dp[5007][5007],n,m,a,b,p;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){scanf("%d%d%d",&a,&b,&p);p++;dp[a][b]=max(dp[a][b],p);}
	int cnt=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			dp[i][j]=max(dp[i][j],max(dp[i-1][j-1],dp[i-1][j])-1);
			if(dp[i][j]>=1)cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 70024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
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 w[100], v[100];
ll dp[105][101010];
int main(){
  int N, W;
  cin >> N >> W;
  rep(i, 0, N) cin >> w[i] >> v[i];
  rep(i, 0, N) rep(j, 0, W) {
    chmax(dp[i + 1][j], dp[i][j]);
    if(j + w[i] <= W) chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
  }
  ll ans = 0;
  rep(i, 0, W + 1) chmax(ans, dp[N][i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 79360
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdio>
#include<utility>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;

int N,M;
int X[100],Y[100],h[100];

void gcl(int& x,int& y){
    if(x<y) swap(x,y);
    while(y>0){
        int t=x%y;
        x=y;
        y=t;
    }
    return;
}


int main(){
    int N,X;cin>>N>>X;
    vector<int> v(N);
    rep(i,0,N){
        int a;cin>>a;
        v[i]=abs(a-X);
    }
    rep(i,1,N){
        gcl(v[i],v[i-1]);
    }

    cout<<v[N-1]<<endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int D = Integer.parseInt(sc.next());
		if (N % (D * 2 + 1) == 0) {
			System.out.println(N / (D * 2 + 1));
		} else {
			System.out.println(N / (D * 2 + 1) + 1);
		}
		sc.close();
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;
template<int64_t M = 1000000007>
class ModInt {
public:
	ModInt() : val_(0) {};

	ModInt(int64_t val) {
		this->val_ = val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0)  this->val_ += M;
	}

	operator int64_t() const {
		return this->val_;
	}

	ModInt& operator += (int64_t val) {
		this->val_ += val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator -= (int64_t val) {
		this->val_ -= val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator *= (int64_t val) {
		this->val_ *= val;
		this->val_ %= M;

		return *this;
	}

	ModInt& operator /= (int64_t val) {
		ModInt v = ModInt::pow(val, M - 2);
		*this *= v;

		return *this;
	}

	ModInt operator + (int64_t v) const {
		ModInt ret = *this;
		return (ret += v);
	}

	ModInt operator - (int64_t v) const {
		ModInt ret = *this;
		return (ret -= v);
	}

	ModInt operator * (int64_t v) const {
		ModInt ret = *this;
		return (ret *= v);
	}

	ModInt operator / (int64_t v) const {
		ModInt ret = *this;
		return (ret /= v);
	}

	static ModInt pow(ModInt n, int64_t m) {
		if (m == 0) {
			ModInt ret(1);
			return ret;
		}
		if (m == 1) {
			return n;
		}

		ModInt v = pow(n, m / 2);
		ModInt ret = v * v;
		if (m & 1) {
			ret *= n;
		}
		return ret;
	}

	ostream& operator << (ostream& out) {
		out << this->val_;
		return out;
	}

private:
	int64_t val_;
};

ModInt<998244353> dp[3001][3001];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n, s; cin >> n >> s;
	vector<int> as(n + 1);
	FOR_LT(i, 0, n) {
		cin >> as[i + 1];
	}

	dp[0][s] = 1;
	FOR_LE(i, 1, n) {
		int a = as[i];
		FOR_LE(v, 0, s) {
			int nv = v - a;
			if (0 <= nv) {
				dp[i][nv] += dp[i - 1][v];
			}
			dp[i][v] += dp[i - 1][v] * (int64_t)2;
		}
	}
	cout << dp[n][0] << endl;

	return 0;
}

Measured memory_bytes: 73904
N, K = map(int, input().split())
P = list(map(int, input().split()))

for i in range(N):
    P[i] = (P[i] + 1) / 2

tmp = 0
for i in range(K):
    tmp += P[i]
ans = tmp

for i in range(K, N):
    tmp += P[i] - P[i - K]
    ans = max(ans, tmp)

print (ans)

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

int main() {
  int x;
  cin>>x;
  if(x<600)
    cout<<"8"<<endl;
  else if(x<800)
    cout<<"7"<<endl;
  else if(x<1000)
    cout<<"6"<<endl;
  else if(x<1200)
    cout<<"5"<<endl;
  else if(x<1400)
    cout<<"4"<<endl;
  else if(x<1600)
    cout<<"3"<<endl;
  else if(x<1800)
    cout<<"2"<<endl;
  else
    cout<<"1"<<endl;
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] shop = new int[N];
		for(int i = 0;i < N;i++) {
			int buf = 0;
			for(int j = 0;j <10;j++ ) {
				buf += Math.pow(2, j) * scn.nextInt();
			}
			shop[i] = buf;
		}

		long[][] P = new long[N][11];
		for(int i = 0;i < N;i++) {
			for(int j = 0;j < 11;j++) {
				P[i][j] = scn.nextLong();
			}
		}

		long bene = Long.MIN_VALUE;
		for(int i = 1;i < 1024;i++) {
			long buf = 0;
			for(int j = 0;j < N;j++) {
				int a = (i & shop[j]);
				buf += P[j][count(a)];
			}
			bene = Math.max(bene, buf);
		}
		System.out.println(bene);

	}

	public static int count(int a) {
		int count = 0;
		while(a>0) {
			if(a % 2 == 1)count++;
			a/=2;
		}
		return count;
	}
}


Measured memory_bytes: 26084
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> v(n), range(k*2, 0), vals(0);
    for(int i=0;i<n;i++){
        cin >> v.at(i); 
    }

    for(int i=0;i<k;i++){
        if(k-1-i < n){
            range.at(i) = v.at(k-1-i);
        }
        if(n-1-i >= 0){
            range.at(k+i) = v.at(n-1-i);
        }
    }
    
    for(int cd=0;cd<=k/2;cd++){
        int x = min(n, k-cd);
        for(int offset=k-x;offset<=k;offset++){
            vector<int> hand(x, 0);
            int val = 0;
            for(int pos=0;pos<x;pos++){
                hand.at(pos) = range.at(pos+offset);
                val += hand.at(pos);       
            }
            vals.push_back(val);
            sort(hand.begin(), hand.end());
            int y = min(x, cd);
            for(int cnt=0;cnt<y;cnt++){
                val -= hand.at(cnt);
                vals.push_back(val);
            }
           
        }
    }

    int val_max = 0;
    for(int i=0;i<vals.size();i++){
        if(vals.at(i) > val_max){
            val_max = vals.at(i);
        }
    }

    cout << val_max << endl;
}

Measured memory_bytes: 896
N = int(input())
li = list(map(int, input().split()))
rli = li[::-1]
rli.append(100001)
ans = [0] * N

ans[0] = rli[0]
for i in range(0, len(li)):
    ans[i+1] = min(rli[i], rli[i+1])

#print(ans)
print(sum(ans))

Measured memory_bytes: 9024
#include <iostream>

int main(){
	int m, f, r;
	char grade;
	while(1){
		std::cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1)
			break;
		if(m == -1 || f == -1)
			grade = 'F';
		else if(m + f >= 80)
			grade = 'A';
		else if(m + f >= 65)
			grade = 'B';
		else if(m + f >= 50)
			grade = 'C';
		else if(m + f >= 30){
			if(r >= 50)
				grade = 'C';
			else
				grade = 'D';
		}
		else
			grade ='F';
		std::cout << grade << std::endl;
	}
	return 0;
}

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

int main()
{
    long long n,p,q;
    cin>>n;
    for(p=sqrt(n);p>=1;p--)
    {
        if(n%p==0)
        {
            q=n/p;
            break;
        }
    }
    cout<<p+q-2;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    string s;
    cin >> s;
    if (s.size() != 2)
        reverse(all(s));
    cout
        << s << endl;
    // end

    return 0;
}


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

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

    for(int i=0;i<N+1;i++){
        for(int j=0;j<N+1-i;j++){
            int k=N-i-j;
            if(10000*i+5000*j+1000*k == Y){
                cout << i << ' ' << j << ' ' << k << endl;
                return 0;
            }
        }
    }

    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
    return 0;

}

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		r: isize,
		g: isize,
	}

	println!("{}", r+(g-r)*2);
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int x; cin >> x;
	for (int i = (int)(x / 100); i >= 0; i--) {
		if (x - (i * 100) <= 5 * i) {
			cout << 1;
			return 0;
		}
		if (x - (i * 100) > 5 * i) {
			cout << 0;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {

//    var (N, K) = readLine()!!.split(" ").map { it.toLong() }
//    var N = readLine()!!.toLong()
    val S = readLine()!!
    val mod = 1000000007

    var R = 0
    var L = 0
    var isL = false

    val list = mutableListOf<Int>()

    for (c in S+"R") {
        if (c == 'R') {
            if (isL) {
                isL = false
                val ave = (R + L) / 2
                if ((R + L) % 2 == 0) {
                    repeat(2) { list.add(ave) }
                }else {
                    val min = Math.min(R, L)
                    var aR = ave
                    var aL = ave

                    if (R > L) aR++
                    else aL++

                    if (min % 2 == 0) {
                        list.add(aR)
                        list.add(aL)
                    } else {
                        list.add(aL)
                        list.add(aR)
                    }
                }
                repeat(L - 1) { list.add(0) }
                R = 0
                L = 0
            }
            R++
        }

        if (c == 'L') {
            if (!isL)
                repeat(R-1) { list.add(0)}
            isL = true
            L++
        }
    }

    println(list.joinToString(" "))

}

Measured memory_bytes: 39928
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define sp " "
#define cs "Case "
#define fi first
#define sn second

/* STL */
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxi(v) distance(v.begin(),max_element(v.begin(),v.end()))
#define mxa(a) *max_element(a, a.size())
#define r(a)   reverse(a.begin(),a.end())
/* loops */
#define fa(i, a, b) for (auto (i) = (a); (i) < (b); ++(i))
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n) i=1;i<=(n);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(something)  cerr<<#something<<" - "<<something<<"\n";

int main()
{

   Ezio
   ll t,m,n,x,a,b;
   string s;

   cin>>n;

   cout<<(n<30?"No":"Yes")<<endl;

   return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, int> pli;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int main() {
	int ret = 0;
	map<int, int> T[2];

	int n;
	cin >> n;

	rep(i, n) {
		int v;
		cin >> v;
		++T[i & 1][v];
	}

	vector<pii> vec[2];

	rep(t, 2) {
		for (auto a : T[t]) {
			vec[t].eb(a.se, a.fi);
		}
		vec[t].eb(0, -1);
		sort(ALL(vec[t]));
		reverse(ALL(vec[t]));
	}

	rep(i, 2) {
		rep(j, 2) {
			if (vec[0][i].se != vec[1][j].se) {
				ret = max(ret, vec[0][i].fi + vec[1][j].fi);
			}
		}
	}

	cout << n - ret << endl;

	return 0;
}

Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
constexpr int MAX = 101;
enum Color { WHITE = 0, GRAY, BLACK};
int n, tt{0};
vv(int, M, MAX, MAX, 0);
vi color(MAX, 0), d(MAX, 0), f(MAX, 0), nt(MAX, 0);
inline int next(int u) {
	rep(v, nt[u], n) {
		nt[u] = v + 1;
		if(M[u][v]) return v;
	}
	return -1;
}
inline void dfs_visit(int r) {
	deque<int> S;
	S.eb(r);
	color[r] = GRAY;
	d[r] = ++tt;
	int u, v;
	while(!S.empty()) {
		u = S.back();
		v = next(u);
		if(v != -1) {
			if(color[v] == WHITE) {
				color[v] = GRAY;
				d[v] = ++tt;
				S.eb(v);
			}
		} else {
			S.pop_back();
			color[u] = BLACK;
			f[u] = ++tt;
		}
	}
}
inline void dfs() {
	tt = 0;
	rep(u, 0, n) {
		if(color[u] == WHITE) dfs_visit(u);
	}
	rep(i, 0, n) {
		cout << i + 1 << " " << d[i] << " " << f[i] << endl;
	}
}
int main() {
	cin >> n;
	int u, k, v;
	rep(i, 0, n) {
		cin >> u >> k;
		--u;
		rep(j, 0, k) {
			cin >> v;
			M[u][--v] = 1;
		}
	}
	dfs();
	return 0;
}

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

using namespace std;

int main() {
	int t = 0, n, a;
	bool flag = 0;
	bool flag1 = 0;
	cin >> n;
	while (n--) {
		cin >> a;
		if (a > t) {
			t = a;
			flag1 = 0;
		}
		else if (a == t)t = a;
		else if (a == t - 1) {
			if (flag1) {
				flag = 1;
				break;
			}
			else {
				flag1 = 1;
				t = a;
			}
		}
		else {
			flag = 1;
			break;
		}
	}
	if (flag)cout << "No" << endl;
	else
		cout << "Yes" << endl;


	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    int cx=x,cy=y;
    int temp;
    for(int i=0; i<n; i++)
    {
        cin>>temp;
        if(temp>cx) cx=temp;
    }
    for(int i=0; i<m; i++)
    {
        cin>>temp;
        if(temp<cy) cy=temp;
    }
    if(cx<cy) cout<<"No ";
    cout<<"War\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define ld long double
using namespace std;
struct _IO{_IO(){ios::sync_with_stdio(0);cin.tie(0);}}_io;

const ld INF=1e10+1;
const int maxn=2e5+5;

int pre1[maxn],pre2[maxn];

void init(int number_p,int *setName)
{
    for(int i=1;i<=number_p;i++)
    {
        setName[i] = i;
    }
}

int query(int x,int *setName)
{
    return setName[x]==x?setName[x]:setName[x] = query(setName[x],setName);
}

void combine(int x,int y,int *setName)
{
    query(x,setName)!=query(y,setName)?setName[query(x,setName)]=query(y,setName):0;
}

int main()
{
    int n,k,l;
    cin>>n>>k>>l;
    init(n,pre1);
    init(n,pre2);
    for(int i=0;i<k;i++)
    {
        int p,q;
        cin>>p>>q;
        combine(p,q,pre1);
    }
    for(int i=0;i<l;i++)
    {
        int r,s;
        cin>>r>>s;
        combine(r,s,pre2);
    }
    for(int i=1;i<=n;i++)
    {
        query(i,pre1);
        query(i,pre2);
    }
    map<pair<int,int>,int> mp;
    for(int i=1;i<=n;i++)
    {
        mp[{pre1[i],pre2[i]}]++;
    }
    for(int i=1;i<=n;i++)
    {
        cout<<mp[{pre1[i],pre2[i]}]<<" ";
    }
}

Measured memory_bytes: 16544