akhauriyash/Code-Regression huggingface dataset:
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll a,b;cin>>a>>b;
    ll n=b-a;
    cout<<(n)*(n-1)/2-a<<endl;
        
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=20;
char str[maxn];
const int INF=1e9;
const double eps=1e-9;
inline int read(){
	int x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	scanf("%s",str);
	if(str[0]=='Y' && str[1]=='A' && str[2]=='K' && str[3]=='I')puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
   int n;
   cin>>n;
   vector<int> a(n);
   for(int i=0;i<n;i++)cin>>a[i];
   sort(a.begin(),a.end());
   int b=min(a[0],a[n-1]-a[0]);
   for(int i=1;i<n-1;i++){
      b=max(min(a[i],a[n-1]-a[i]),b);
   }
   for(int i=0;i<n;i++){
      if(a[i]>=b && a[n-1]-a[i]>=b){
         cout<<a[n-1]<<" "<<a[i]<<endl;
         return 0;
      }
   }
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
//const int mod = 1000000007;
const ll mod = INF / 1000;




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

    cout << (n * 800) - ((n / 15) * 200 ) << endl;

}


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

int main(void) {

  long n;
  scanf("%ld", &n);
  long t[n],x[n],y[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld %ld %ld", &t[i], &x[i], &y[i]);
  }

  long distance = x[0]+y[0];
  if (distance > t[0]) {
    printf("No\n");
    return 0;
  } else if ((t[0]-distance)%2 != 0) {
    printf("No\n");
    return 0;
  }
  for (long i = 1; i < n; i++) {
    distance = labs(x[i]-x[i-1])+labs(y[i]-y[i-1]);
    if (distance > t[i]-t[i-1]) {
      printf("No\n");
      return 0;
    } else if ((t[i]-t[i-1]-distance)%2 != 0) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");

  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

set<ll> s;
void dfs(ll x) {
  if (x > 1e11) return;

  x *= 10;
  int y = x / 10 % 10;
  rep(i, 10) {
    if (abs(i - y) > 1 || s.count(x + i)) continue;
    s.insert(x + i);
    dfs(x + i);
  }
}
void solve() {
  rep(i, 10) {
    s.insert(i);
    dfs(i);
  }

  int k;
  cin >> k;
  int cnt = 0;
  for (auto e : s) {
    cnt++;
    if (cnt == k + 1) {
      cout << e << endl;
      break;
    }
  }
}


Measured memory_bytes: 79616
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	int n, m;
	cin>>n>>m;
	vector<P> arm(m);
	REP(i, m) {
		cin>>arm[i].first>>arm[i].second;
		--arm[i].second;
	}
	sort(ALL(arm));
	vector<ll> cnt(n, -1);    //?????????
	vector<ll> bef(m);        // ??\????????§??????????¢????????????
	REP(i, m) {
		bef[i] = cnt[arm[i].second];
		cnt[arm[i].second] = i;
	}
	vector<ll> pos(n, 1); // ??????¨????????????§???
	vector<P> trns(m);    // ??§????????????????
	REP(i, m) {
		if(bef[i] == -1) {
			pos[arm[i].second + 1] = pos[arm[i].second] = pos[arm[i].second] + pos[arm[i].second + 1];
		} else {
			ll buf = pos[arm[i].second];
			pos[arm[i].second] += pos[arm[i].second + 1] - trns[bef[i]].first;
			pos[arm[i].second + 1] += buf - trns[bef[i]].second;
		}
		trns[i].first = pos[arm[i].second + 1];
		trns[i].second = pos[arm[i].second];
	}
	REP(i, n) {
		cout<<pos[i];
		if(i != n - 1) cout<<' ';
		else cout<<endl;
	}
}

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

int main() {
  string w;
  cin >> w;
  vector<int> num('z' - 'a'+ 1);
  int i;
  for (i = 0; i < w.length(); i++) {
    num[w.at(i) - 'a']++;
  }
  for (i = 0; i < 'z' - 'a'+ 1; i++) {
    if (num[i] % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,ans=0;
	cin>>n;
	for (ll i=1;i<=n;i++)
	{
		for (ll j=i;j<=n;j+=i)
		{
			ans+=j;
		}
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>
#define max(a,b) ((a)>(b)?(a):(b))
int main(){
  char s[11];
  int ans=0,i,buf=0;
  scanf("%s",s);
  int n=strlen(s);
  for(i=0;i<n;i++){
    if(s[i]=='A'||s[i]=='G'||s[i]=='C'||s[i]=='T'){
      ans++;
      buf=max(buf,ans);
    }
    else ans=0;
  }
  printf("%d",buf);
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int dp[1001][1001];

int main () {
  string s1,s2;
  cin>>s1>>s2;

  for(int i=0;i<=s1.size();++i) {
    dp[i][0] = i;
  }

  for(int j=0;j<=s2.size();++j) {
    dp[0][j] = j;
  }

  for(int i=1;i<=s1.size();++i) {
    for(int j=1;j<=s2.size();++j) {
      int rep = int(s1[i-1] != s2[j-1]);
      dp[i][j] = min(dp[i-1][j-1]+rep, min(dp[i-1][j]+1, dp[i][j-1]+1));
    }
  }
  cout<<dp[(int)s1.size()][(int)s2.size()]<<endl;

  return 0;
}


Measured memory_bytes: 7100
a, b, c, d = map(int, input().split())

turn = 1
while True:
    if turn % 2 != 0:
        c = c - b
        if c <= 0:
            print('Yes')
            exit()
        else:
            turn += 1
    else:
        a = a - d
        if a <= 0:
            print('No')
            exit()
        else: 
            turn += 1


Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> Pii;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1000000000
#define rep(i,a,b) for(int i =(a);i<(b);i++)
#define first fs
#define second ss
inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

template<typename T, typename U>
static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}

// call by reference is used in x
template<typename T, typename U>
static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}
//////////////////////////////////////end of template//////////////////////////////////////

int main(){

 
 string s1,s2;
 cin >> s1 >> s2;
 
 int ans = 0;
 rep(i,0,3) if( s1[i] == s2[i]) ans++;
  
 cout << ans <<endl;



}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==v.size()?"":" ");
    return os;
}


signed 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 if(x<2000)cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

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

  ll t = a+b+c;
  int mini = std::min({a,b,c});
  int maxi = std::max({a,b,c});
  int mid = t - mini - maxi;

  if(t%2 == 0)
    std::cout << 0 << '\n';

  else
    std::cout << (ll)mini*mid << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define min(a,b) a>b?b:a
#define max(a,b) a>b?a:b

int main(){
    int n,i,x,y,k;

    scanf("%d%d",&n,&k);

    for(;k-->0;){
        scanf("%d%d",&x,&y);

        x=min(x,n+1-x);
        y=min(y,n+1-y);
        x=min(x,y);
        x=x%3?x%3:3;
        printf("%d\n",x);
    }
    return 0;
}

Measured memory_bytes: 596
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, g = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    if n == 1:
        print(abs(a[0]-g))
        return
    
    a.append(g)
    a.sort()
    b = []
    for i in range(1, n+1):
        b.append(a[i]-a[i-1])
    g = b[-1]
    for e in b:
        g = gcd(e, g)
    print(g)
    




        

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


Measured memory_bytes: 20408
program main
      implicit none
      integer(4) :: k, n, i, dis
      integer(4), allocatable :: a(:), diff(:)

      read(*,*) k, n
      allocate( a(n) )
      read(*,*) a
      allocate( diff(n) )

      do i = 1, n
        if ( i == n ) then
          diff(i) = a(1) + k - a(n)
        else
          diff(i) = a(i+1) - a(i)
        end if
      end do

      dis = k - maxval( diff )
      print *, dis 

end program main


Measured memory_bytes: 2688
import sys

INF = sys.maxsize

N = int(input().strip())
h = [int(x) for x in input().split()]

memo = [INF] * N

for i in range(N - 1, -1, -1):
  if i == N -1:
    memo[i] = 0
  else:
    memo[i] = min(
      memo[i + 1] + abs(h[i] - h[i + 1]) if i + 1 < N else INF,
      memo[i + 2] + abs(h[i] - h[i + 2]) if i + 2 < N else INF                        
    )
  
print(memo[0])

Measured memory_bytes: 13980
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=(n);i++)
#define Endl endl
int main(){
	int a,b,ans=0;
	cin>>a>>b;
	ans=(a+b)/2;
	if((a+b)%2!=0){
		ans++;
	}
	cout<<ans<<Endl;
	return 0;
}

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

int main()
{
    double N;
    cin >> N;
    double oddCount = 0;

    for(double i = 1; i <= N; i += 2.0)
    {
        oddCount++;
    }

    cout << fixed << setprecision(10) << oddCount / N << endl;

    return 0;
    
}

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

namespace Contest
{
    class Program
    {


        public void Solve()
        {
            var sc = new Scanner();
            int A = sc.NextInt();
            int B = sc.NextInt();
            int T = sc.NextInt();

            Console.WriteLine(B * (T / A));
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }

    private char _separator;
    private StreamReader _stream;
    private int _pos;
    private string[] _line;

    #region get a element

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region convert array

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region get array

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int x, y;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        x = sc.nextInt();
        y = sc.nextInt();
        solve();
    }

    void solve() {
        if (x == 2) {
            System.out.println("No");
        } else if (x == 4 || x == 6 || x == 9 || x == 11) {
            if (y == 6 || y == 9 || y == 11) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } else {
            if (y == 2 || y == 4 || y == 6 || y == 9 || y == 11) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21076
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

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

    int N=0;    

    if(X == 1){
        cout << 1 << endl;
        return 0;
    }


    for(int i=2;i<32;i++){
        for(int j=2;pow(i, j)<=X;j++){
            if(pow(i, j)>N && N<=X)
                N = pow(i, j);
        }
    }

    cout << N << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<int> vec;

void solve(){
	int a, b; cin >> a >> b;
	string s; cin >> s;
	if (s[a] != '-') {
		cout << "No" << endl; return;
	}
	int cnt = 0;
	rep(i, s.size())if (s[i] == '-')cnt++;
	if (cnt != 1) {
		cout << "No" << endl; return;
	}
	cout << "Yes" << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(6);
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            var ls = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();

            if (N == 1)
            {
                Console.WriteLine("0");
                return;
            }


            for (int i = 0; i < ls.Count(); i++)
            {
                ls[i] -= i + 1;
            }

            ls.Sort();
            var ans = ls.Select(x => Math.Abs(x - ls[int.Parse((N / 2).ToString())])).Sum();
            var ansMax = ls.Select(x => Math.Abs(x - ls[int.Parse(((N / 2) + 1).ToString())])).Sum();
            var ansMin = ls.Select(x => Math.Abs(x - ls[int.Parse(((N / 2) - 1).ToString())])).Sum();

            Console.WriteLine((Math.Min(ans, Math.Min(ansMax, ansMin))).ToString());
        }
    }
}


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

// 小数点以下桁数
// fixed << setprecision(i)

int gcd(int a,int b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//   for(auto x : v) cout << x << " "; cout << "\n";    // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

int main()
{
  string s, t;
  int ans = 0;

  cin >> s >> t;
  for (int i = 0; i < s.size(); i++)
  {
    if (s[i] != t[i])
      ans++;
  }
  cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    string n;
    cin >> n;
    int sum = 0;
    for (int i = 0; i < n.length(); ++i) {
        sum += n[i] - '0';
    }

    if (sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int n = 1, h, ans;
  cin >> h;
  while(h != 1) {
    n++;
    h /= 2;
  }
  //cout << n << "\n";
  ans = (1LL << n);
  ans--;
  cout << ans;
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;
 
public class Main{
	static final Scanner s=new Scanner(System.in);
	static int getInt(){
		return Integer.parseInt(s.next());
	}
	static IntStream REPS(int r){
		return IntStream.range(0,r);
	}
	public static void main(String[] __){
		int h=getInt(),w=getInt();
		char[][]f=REPS(h).mapToObj(i->s.next().toCharArray())
				.toArray(char[][]::new);
		
		int x=0,y=0;
		while(x!=w-1||y!=h-1) {
			if(x<w-1&&f[y][x+1]=='#') {
				f[y][++x]='.';
				continue;
			}
			if(y<h-1&&f[y+1][x]=='#') {
				f[++y][x]='.';
				continue;
			}
			System.out.println("Impossible");
			return;
		}
		
		f[0][0]='.';
		for(char[] c:f)for(char cc:c) {
			if(cc=='#') {
				System.out.println("Impossible");
				return;
			}
		}
		System.out.println("Possible");
	}
}

Measured memory_bytes: 29140
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#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,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
constexpr auto oorret = 0;
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }

class UnionFind {
private:
	vector<int> par, height, size;
public:
	UnionFind(int n) {
		par.resize(n);
		REP(i, n) {
			par[i] = i;
		}
		height.resize(n, 0);
		size.resize(n, 1);
	}
	int root(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			par[x] = root(par[x]);
			return par[x];
		}
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y)return;
		if (height[x] < height[y]) {
			par[x] = y;
			size[y] += size[x];
		}
		else {
			par[y] = x;
			size[x] += size[y];
			if (height[x] == height[y])height[x]++;
		}
	}
	int cnt(int x) {
		x = root(x);
		return size[x];
	}
};

int main() {
	int n,m;
	cin >> n >> m;
	vector<int> x(m);
	vector<int> y(m);
	vector<int> z(m);
	REP(i, m) {
		cin >> x[i] >> y[i] >> z[i];
		x[i]--;
		y[i]--;
	}
	UnionFind uf(n);
	REP(i, m) {
		uf.unite(x[i], y[i]);
	}
	vector<int>  w(n, -1);
	REP(i, n) {
		w[uf.root(i)] = 1;
	}
	int res = 0;
	REP(i, n) {
		if (w[i] > 0) {
			res++;
		}
	}
	put(res);
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
using namespace std;
static const int Max = 200000;

int main() {
int R[Max], n;
cin >> n;
for ( int i = 0; i < n; i++ ) cin >> R[i];

int maxv = -2000000000;
int minv = R[0];

for ( int i = 1; i < n; i++ ) {
  maxv = max(maxv, R[i] - minv);
  minv = min(minv, R[i]);
}

cout << maxv << endl;

return 0;
}



Measured memory_bytes: 3876
#  s = int(input())
#  s = map(int, input().split())
#  s = list(map(int, input().split()))

def main():
  s = list(input())
  n = len(s)
  m = (n-1)//2
  l = (n+3)//2
  
  
  f = s==s[::-1]
  
  t = s[:m]
  
  g = t == t[::-1]
  
  r = s[l-1:]
  
  h =  r == r[::-1]
  
  
  
  if f and g and h:
    print('Yes')
  else:
    print('No')
		

if __name__=='__main__':
    main()

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

int main(){
    int r, d, x;
    cin >> r >> d >> x;

    for (int tsumugi = 0; tsumugi < 10; tsumugi++){
        x = (r * x - d);
        cout << x << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N, K;
	cin >> N >> K;
	vector<ll> a(N);
	REP(i, N) { cin >> a[i]; }
	ll res = INT64_MAX;
	for (int bit = 0; bit < (1 << N); ++bit) {
		vector<int> choice(N);
		int cnt = 0;
		REP(i, N) {
			if (bit >> i & 1) {
				choice[i] = 1;
				++cnt;
			}
		}
		if (cnt != K) continue;

		ll sum = 0;
		ll mx = 0;
		REP(i, N) {
			if (a[i] > mx) {
				mx = a[i];
			} else if (choice[i]) {
				++mx;
				sum += mx - a[i];
			}
		}
		res = min(res, sum);
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

ll color[12345678], ko[12345678];
signed main() {
	while (true) {
		ll n, a; cin >> n;
		if (n == 0) { break; }
		ll saigo = 0, z = 0;
		rep(i, n) {
			cin >> a; a += 2;
			if (i == 0) { color[z] = a; ko[z] = 1; z++; }
			else if (i % 2 == 0) {
				if (saigo == a) { ko[z - 1]++; }
				else { color[z] = a; ko[z] = 1; z++; }
			}
			else {
				if (saigo == a) { ko[z - 1]++; }
				else {
					if (z == 1) {
						color[z - 1] = a; ko[z - 1]++;

					}
					else {
						ko[z - 2] += 1 + ko[z - 1];
						color[z - 1] = 0; ko[z - 1] = 0; z--;
					}
				}
			}
			saigo = a;
		}
		ll ans = 0;
		rep(i, z) {
			//cout << color[i] << ' ' << ko[i] << endl;
			if (color[i] == 2) { ans += ko[i]; }
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define deb(x) cout<<#x<<" "<<endl;
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
//-------------------------------------------------------------------------------





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

	vll dp(w+1);
	
	for(int i=0;i<n;++i){
		int value,weight;
		cin>>weight>>value;
		for(int j=w-weight;j>=0;--j){
			dp[j+weight]=max(dp[j+weight],dp[j]+value);
		}
	}
	// for(int i=0;i<=w;++i){
	// 	cout<<dp[i]<<endl;
	// }
	ll ans = dp[w];
	cout<<ans;
	
}
 

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//









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

        int aa = (int)(s[0]-'0')*10 + (int)(s[1]-'0');
        int bb = (int)(s[2]-'0')*10 + (int)(s[3]-'0');

        if(0 < aa && aa <= 12 && 0 < bb && bb <= 12) cout << "AMBIGUOUS" << endl;
        else if(0 <= aa && 0 < bb && bb <= 12) cout << "YYMM" << endl;
        else if(0 < aa && aa <= 12 && 0 <= bb) cout << "MMYY" << endl;
        else cout << "NA" << endl;

}




















Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 2147483647;
int prime = 998244353;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;
void nu(){}


signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    cin >> n;
    vec(a,n);
    input(a,n);
    int cnt = 0;
    REP(i,n){
        FOR(j,i+1,n){
            FOR(k,j+1,n){
                if(a[i] == a[j] || a[j] == a[k] || a[i] == a[k]){
                    continue;
                }
                int in = min({a[i],a[j],a[k]});
                int ax = max({a[i],a[j],a[k]});
                int to = a[j]+a[i]+a[k];
                if(to-ax>ax){
                    cnt++;
                }
            }
        }
    }

    print(cnt);

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 3636
M,D = map(int,input().split())
num = 0
for i in range(1,M+1):
        for j in range(22,D+1):
                lis = list(str(j))

                if int(lis[0])<=1 or int(lis[1])<=1:
                        lis =[]
                        continue
                if int(lis[0])*int(lis[1]) == i:
                        num+=1
                lis =[]                
print(num)


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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
int cou[4];

int main(int argc, char const* argv[])
{
  unordered_map<char, int> mp;
  mp['N'] = 0;
  mp['S'] = 1;
  mp['W'] = 2;
  mp['E'] = 3;
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    cou[mp[s[i]]]++;
  }
  if((cou[0] == 0 && cou[1] != 0) || (cou[0] != 0 && cou[1] == 0) ||
      (cou[2] != 0 && cou[3] == 0) || (cou[2] == 0 && cou[3] != 0)){
    cout << "No" << endl;
  }
  else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
   public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] values = new int[w];
        for (int i = 0; i < w; i++){
            values[i] = i + 1;
        }
        for (int i = 0; i < n; i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            int j = values[a];
            values[a] = values[b];
            values[b] = j;
        }
        for (int i = 0; i < w; i++)
            System.out.println(values[i]);
    }
}



Measured memory_bytes: 26160
#include<stdio.h>
void insertionSort(int *,int,int);
void shellSort(int *,int);
int cnt=0;
int m=0;
int G[100];
int main(){
  int A[1000001];
  int i;
  int N;
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  shellSort(A,N);
  printf("%d\n",m);
  for(i=m-1;i>=0;i--){
    printf("%d",G[i]);
    if(i) printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  for(i=0;i<N;i++){
    printf("%d\n",A[i]);
  }
  return 0;
}

void insertionSort(int A[],int n,int g){
  int i,j,v;
  for(i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0 && A[j]>v){
      A[j+g]=A[j];
      j=j-g;
      cnt++;
    }
    A[j+g]=v;
  }
}

void shellSort(int A[],int n){
  int i;
  int ret=0;
  cnt=0;
  while(1){
    ret=ret*3+1;
    if(ret>n) break;
    G[m++]=ret;
  }
    
  for(i=0;i<m;i++){
    insertionSort(A,n,G[m-i-1]);
  }
}
  



Measured memory_bytes: 5688
import math
n = int(input())
q = int(math.sqrt(n))

ans = []
scores = []

div = 2
score = 0
while True:
  if div > q or div > n:
    if n != 1:
      ans.append(int(n))
      scores.append(1)
    break
  while n % div ==0:
    n /= div
    ans.append(div)
    score += 1
  else:
    div += 1
    if score > 0 :
      scores.append(score)
    score = 0
#print(ans,scores)

count = 0
for score in scores:
  i=1
  while score >= i:
    score -= i
    i += 1
    count += 1
print(count)

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

#define MOD 1000000007
typedef unsigned long long ull;

int k, s;

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

  int ans = 0;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (z >= 0 && z <= k) {
        ans++;
      }
    }
  }

  cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int m=200010;
const int maxn=5e5+50;
char s[maxn],ori[maxn];
int main(){
    cin>>ori;
    int len=strlen(ori);
    for(int i=m;i<=m+len;i++)
        s[i]=ori[i-m];
    int head=m-1,tail=m+len;
    int Q,T,F;
    char c;
    cin>>Q;
    while(Q--)
    {
        cin>>T;
        if(T==1)swap(head,tail);
        else{
            cin>>F>>c;
            if(F==1)
            {
                if(head<tail)s[head--]=c;
                else s[head++]=c;
            }
            else
            {
                if(head<tail)s[tail++]=c;
                else s[tail--]=c;
            }
        }
    }
    if(head<tail)
        for(int i=head+1;i<=tail-1;i++)
            cout<<s[i];
    else
        for(int i=head-1;i>=tail+1;i--)
            cout<<s[i];
    return 0;
}


Measured memory_bytes: 1024
/*
  AtCoder Beginner Contest 087
  C - Candies
*/

#include<iostream>
using namespace std;

int N, A;
int row1[101] = {0}, row2[101] = {0};

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A);
    row1[i] = row1[i-1] + A;
  }
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A);
    row2[i] = row2[i-1] + A;
  }

  // 下る位置を探索
  int maxval = -1;
  for (int i = 1; i <= N; ++i) {
    int val = row1[i] - row1[0] + row2[N] - row2[i-1];
    if (val > maxval) maxval = val;
  }

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
using namespace std;
#define f(n) for(int i=0;i<n;++i)

int main() {
    #define int long long
	int n;
	cin >> n;
	vector<int>f, s;
	if (n % 2 == 0) {
		f(n) {
			int t;
			cin >> t;
			if (i % 2 == 1) {
				f.insert(f.begin(), t);
			}
			else {
				s.push_back(t);
			}
		}
	}
	else {
		f(n) {
			int t;
			cin >> t;
			if (i % 2 == 0) {
				f.insert(f.begin(), t);
			}
			else {
				s.push_back(t);
			}
		}
	}
	f(f.size()) {
		cout << f[i] << " ";
	}
	f(s.size()) {
		cout << s[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 3948
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	char c; cin >> c;
	cout << ++c << endl;
	return;
}

int main() {
	solve();
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    N = int(input())
    a_list = list(map(int, input().split()))
    f, t, o = 0, 0, 0
    for a in a_list:
        if a % 4 == 0:
            f += 1
        elif a % 2 == 0:
            t += 1
        else:
            o += 1

    if f >= (N // 2) or f >= o:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 14628
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        String W = input.next();
        int count = 0;
        while (true) {
            String T = input.next();
            if ("END_OF_TEXT".equals(T)) break;
            if (W.equalsIgnoreCase(T)) count++;
        }
        System.out.println(count);
    }
}

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

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  int k = 0, e = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'b') e++;
    if(s[i] == 'a'){
      if(a+b > k){
        cout << "Yes" << endl;
        k++;
      }else{
        cout << "No" << endl;
      }
    }else if(s[i] == 'b'){
      if(a+b > k && b >= e){
        cout << "Yes" << endl;
        k++;
      }else{
        cout << "No" << endl;
      }
    }else cout << "No" << endl;
  }
}

Measured memory_bytes: 3720
#include <vector>
#include <map>
#include <string>
#include <tuple>

using namespace std;

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

int N;
char S[50];


map<tuple<int, int, string>, long long> memo;
long long go(int L, int R, string suf)
{
	if (suf.size() > R-L) return 0;
	if (L == R) return suf.empty();

	auto entry = tuple<int, int, string>(L, R, suf);
	if (memo.find(entry) != memo.end()) return memo[entry];


	long long result = 0;
	if(!suf.empty())
	{
		if(S[L] == suf.back())
		{
			result += go(L+1, R, suf.substr(0, suf.size() - 1));
		}
		FOR(i,L+1,R)
			if(S[L] == S[i])
			{
				result += go(L+1,i,string(S+i+1,S+R)+suf);
			}
	}
	else
	{
		FOR(i,L+1,R) 
			if(S[L] == S[i])
			{
				result += 2*go(L+1,i,string(S+i+1,S+R));
			}
	}

	return memo[entry] = result;
}


int main() {
	scanf("%d", &N);
	scanf("%s", S);
	printf("%lld\n", go(0,2*N,string()));
}

Measured memory_bytes: 256
n, k = map(int, input().split())
h = sorted([int(input()) for _ in range(n)], reverse=True)
ans = h[0]
for i in range(n-k+1):
  if (h[i]-h[i+k-1])<ans:
    ans=h[i]-h[i+k-1]
print(ans)

Measured memory_bytes: 51032
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
	string input = chomp(readln());
	switch(input) {
		case "a", "i", "u", "e", "o":
			"vowel".writeln;
			break;
		default:
			"consonant".writeln;
			break;
	}
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    for (int i = 0; i < n; i++) {
        cin >> b.at(i);
    }
    for (int i = 0; i < n - 1; i++) {
        cin >> c.at(i);
    }
    
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += b.at(i);
    }
    
    for (int i = 0; i < n - 1; i++) {
        if (a.at(i) + 1 == a.at(i + 1)) sum += c.at(a.at(i) - 1);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
main = sol . fmap get . tail . lines <$> getContents >>= print

get = fmap read . words

sol = f (1,1)

f (t,a) [] = t+a
f (t,a) ([t',a']:ps) = f (m*t',m*a') ps where
  m = 1 + max ((t-1) `div` t') ((a-1) `div` a')

Measured memory_bytes: 1532
if __name__ == '__main__':
    N = int(input())
    S = []
    P = []
    num = []
    for i in range(N):
        s = input().rstrip().split(' ')
        S.append(s[0])
        P.append(int(s[1]))
        num.append(i+1)

    Z = list(zip(S,P,num))

    Z.sort(key=lambda k:k[1],reverse=True)
    Z.sort(key=lambda k:k[0])

    for elem in Z:
        print(elem[2])

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
using std::swap;
const int MAX_SIZE = 100005;
int parent[MAX_SIZE];
int size[MAX_SIZE];
int arr[MAX_SIZE];
int N, M, x, y;

void init() {
    for (int i = 1; i <= N; ++i) {
        parent[i] = i;
        size[i] = 1;
    }
}

int find(int p) {
    if (parent[p] == p) return p;
    else return parent[p] = find(parent[p]);
}

void uNion(int p, int q) {
    p = find(p);
    q = find(q);
    if (size[p] < size[q]) {
        swap(p, q);
    }

    parent[q] = p;
    size[p] += size[q];
}

int main() {
    scanf("%d %d", &N, &M);
    for (int i = 1; i <= N; ++i) {
        scanf("%d", arr+i);
    }
    init();
    while (M--) {
        scanf("%d %d", &x, &y);
        uNion(x, y);
    }
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        if (find(i) == find(arr[i])) {
            ++ans;
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1280
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int result = 1;
		int maxCount = 0;
		
		int x = sc.nextInt();
		for (int i = x; i > 0; i--) {
		    int count = 0;
		    int num = i;
		    while (num % 2 == 0) {
		        count++;
		        num = num / 2;
		    }
		    
		    if (count >= maxCount) {
		        maxCount = count;
		        result = i;
		    }
		}
		
		// output
		System.out.println(result);
	}
}

Measured memory_bytes: 22740