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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

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

	return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
taka = ""
ans=0
for i in range(N):
	if(i>=K):
		if(T[i] == taka[i-K]):
			taka+="n"
			continue
	if(T[i]=="r"):
		ans+=P
		taka+="r"
	elif(T[i]=="s"):
		ans+=R
		taka+="s"
	else:
		ans+=S
		taka+="p"
print(ans)

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

using namespace std;

int main() {
 int n;
 set<string> all;
 cin >> n;
 for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    all.insert(s);
 }
 cout << all.size();
 return 0;
}


Measured memory_bytes: 19124
H, W = map(int, input().split())
a = [input() for i in range(H)]
 
a = ["".join(row) for row in zip(*a) if row.count("#") > 0]
a=  ["".join(row) for row in zip(*a) if row.count("#") > 0]
 
print("\n".join(a))

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

int main(void) {
    char c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }

    cout << c[0][0] << c[1][1] << c[2][2] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int N,a[150],i,j,sum=0;
    scanf("%d",&N);
    for(i=0; i<N; i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0; i<N; i++)
    {
        for(j=i+1; j<N; j++)
        {

          sum=sum+a[i]*a[j];

        }

    }

    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

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

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	
	vector<char> arr;
	int K;	
	string str;
	cin>>str;
	cin>>K;
	

	int N = str.size();


	for(int i = 0;i < N;i++){
		arr.push_back(str[i]);
	}


start_point:

	for(int i = 0;i < N;i++){
		if(arr[i] == 'a')continue;

		int sabun = static_cast<int>('z' - arr[i]) + 1;
		// cout<<"sa"<<sabun<<endl;	
		if(K >= sabun){
			K -= sabun;
			arr[i] = 'a';
		}
	}
	
	K %= 26;	

	int itr = N -1;
	while(K>0){
		int sabun = static_cast<int>('z' - arr[itr]) ;
		if(K >= sabun){
			arr[itr] += char(sabun);
			K -= sabun;
		}else{
			arr[itr] += char(K);
			K = 0;
		}

		if(itr == 0){
			goto start_point;
		}
		itr--;
	}

	REP(i,N){
		cout<<arr[i];
	}
	cout<<endl;
	return 0;

}



Measured memory_bytes: 896
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n,m=map(int,input().split())
root=[-1]*(n+1)
def r(x):
    if root[x]<0:
        return x
    else:
        root[x]=r(root[x])
        return root[x]
def unite(x,y):
    x=r(x)
    y=r(y)
    if x==y:
        return
    if x>y:
        x,y=y,x

    root[x]+=root[y]
    root[y]=x
def size(x):
    x=r(x)
    return -root[x]
for i in range(m):
    x,y=map(int,input().split())

    unite(x,y)
ans=0
for i in range(n):
    ans=max(ans,size(i+1))
print(ans)




Measured memory_bytes: 79672
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#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 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;

long n,ww;
vector<long> w, v;
vector<long> zz[4];
vector<long> szz[4];

void calc( long k, ll cst0, ll sum0, ll& ans )
{
    if(k==4) {
        ans=MAX(ans,sum0);
        return;
    }
    long j;
    for(j=0; j<=(long)zz[k].size(); j++) {
        ll cst=cst0+j*(w[0]+k);
        if(cst>ww) continue;
        ll sum=sum0+szz[k][j];
        calc(k+1, cst, sum, ans);
    }
    return;
}

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

    w.resize(n);
    v.resize(n);
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld%ld", &w[i], &v[i]);
        zz[w[i]-w[0]].push_back(v[i]);
    }
    for(i=0; i<4; i++) {
        sort(zz[i].rbegin(), zz[i].rend());
    }

    long k;
    for(k=0; k<4; k++) {
        szz[k].resize(zz[k].size()+1);
        szz[k][0]=0;
        for(i=0; i<(long)zz[k].size(); i++) {
            szz[k][i+1]=szz[k][i]+zz[k][i];
        }
    }

    ll ans=0;
    calc(0,0,0,ans);

    printf("%lld\n", ans);

    return 0;
}


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const char c[4] = {'N', 'S', 'E', 'W'};
bool is[4];

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	string s;
	getline(cin, s);
	memset(is, 0, sizeof(is));
	forn(i, sz(s)) {
		forn(j, 4) {
			if (s[i] == c[j]) {
				is[j] = 1;	
			}
		}
	}
	if (is[0] ^ is[1]) {
		puts("No");
	} else 
	if (is[2] ^ is[3]) {
		puts("No");
	} else {
		puts("Yes");
	}
	return 0;
}


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

string S;

int main() {
    cin >> S;
    
    int number = 0; //文字列の中のWの数
    long long answer = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'W') {
            answer += i - number;
            number++;
        }
    }
    
    cout << answer << endl;
}

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

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

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

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> 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 (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N; cin >> N;
  int T, A; cin >> T >> A;
  vector<double> h(N); rep(i, 0, N){ cin >> h[i]; }
  vector<double>t(N);
  int ans=0;

  rep(i,0,N){
    t[i]=T-0.006*h[i];
    if(abs(t[ans]-A)>abs(t[i]-A)){
      ans=i;
    }
  }
  cout<<ans+1<<endl;

    return 0;
}


Measured memory_bytes: 256
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int a,b,c;

int main()
{
	cin>>a>>b>>c;
	cout<<min(a+b,min(a+c,b+c))<<endl;
	rt0;
}

Measured memory_bytes: 764
#include <stdio.h>

long long abs(long long num)
{
	if(num < 0)
		return -num;
	else
		return num;
}

int main(void)
{
	int n;
	long long a[200000];
	long long all, sunuke, min;
	int i;
	
	scanf("%d", &n);
	all = 0;
	for(i=0; i<n; i++){
		scanf("%lld", &a[i]);
		all += a[i];
	}
	
	sunuke = a[0];
	min = abs(2*sunuke-all);
	for(i=1; i<n-1; i++){
		sunuke += a[i];
		
		if( abs(2*sunuke-all) < min )
			min = abs(2*sunuke-all);
	}
	
	printf("%lld\n", min);
	
	return 0;
}

Measured memory_bytes: 1664
using System;
using System.Linq;

namespace ITP1_3
{
    class Program
    {
        static void Main()
        {
            int[] i = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = i[0]; int b = i[1] - a + 1; int c = i[2];
            Console.Write("{0}\n", Enumerable.Range(a, b).Where(e => c % e == 0).Count());
        }
    }
}

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

using namespace std;

int main()
{
    long long int n;
    cin >> n;
    long long int sum = 0;
    for(int i = 1; i <= n; i++)
    {
        if(i%3 == 0)
            continue;
        if(i % 5 == 0)
            continue;
        sum += i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void merge(int [],int,int,int);
void mergesort(int [],int,int);

#define na 500000
#define INFTY 1000000000

int change = 0;

int L[na],R[na];

int main()
{
  int i = 0,A[na],n = 0;

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

  for(i = 0;i < n;i++)
    {
      printf("%d",A[i]);
      if( i < n-1 )
	{
	  printf(" ");
	}
    }
      printf("\n%d\n",change);

      return 0;
}
void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i = 0;i < n2;i++)
    {
      L[i] = A[left + i];
    }
  for(i = 0;i < n2;i++)
    {
      R[i] = A[mid + i];
    }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k = left;k < right;k++)
    {
      change++;
      if(L[i] <= R[j])
	{
	  A[k] = L[i];
	  i += 1;
	}
      else
	{
	  A[k] = R[j];
	  j += 1;
	}
    }
}
void mergesort(int A[],int left,int right)
{
  int mid;
  if( left+1 < right )
    {
      mid = (left + right)/2;
      mergesort(A,left,mid);
      mergesort(A,mid,right);
      merge(A,left,mid,right);
    }
}



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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<ll>>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, s, n, d) for (int i = (s); i < (int)(n); i += (d))
#define allpt(v) (v).begin(), (v).end()
#define allpt_c(v) (v).cbegin(), (v).cend()
#define allpt_r(v) (v).rbegin(), (v).rend()

const int mod = 1e9 + 7;

const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(const vector<T> &v)
{
    if (v.size() == 0)
        return;
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;
    return;
}

template <typename T>
void show2dvec(const vector<vector<T>> &v)
{
    int n = v.size();
    rep(i, n) show1dvec(v[i]);
}

template <typename T, typename S>
void show1dpair(const vector<pair<T, S>> &v)
{
    int n = v.size();
    rep(i, n) cout << v[i].first << wsp << v[i].second << rt;
    return;
}

template <typename T, typename S>
void pairzip(const vector<pair<T, S>> &v, vector<T> &t, vector<T> &s)
{
    int n = v.size();
    rep(i, n)
    {
        t.push_back(v[i].first);
        s.push_back(v[i].second);
    }
    return;
}

template <typename T>
void maxvec(vector<T> &v)
{
    T s = v[0];
    int n = v.size();
    rep(i, n - 1)
    {
        if (s > v[i + 1])
        {
            v[i + 1] = s;
        }
        s = v[i + 1];
    }
}

template <typename T, typename S>
bool myfind(T t, S s)
{
    return find(t.cbegin(), t.cend(), s) != t.cend();
}

bool check(int y, int x, int h, int w)
{
    return 0 <= y && y < h && 0 <= x && x < w;
}

VI cumsum(VI &v)
{
    int s = 0;
    VI ret = {0};

    rep(i, v.size())
    {
        s += v[i];
        ret.push_back(s);
    }
    return ret;
}

void shuffle(VI &v, int t)
{
    int temp = v[t - 1];
    rep(i, t - 1) v[t - 1 - i] = v[t - 2 - i];
    v[0] = temp;
}



int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif
    // string s;
    // cin >> s;
    // string ans = "No";
    // if (s[2] == s[3] && s[4] == s[5]) ans = "Yes";
    // cout << ans << rt;

    ll x, ans = 0;
    cin >> x;
    ans += x / 500 * 1000;
    x %= 500;
    ans += x / 5 * 5;
    cout << ans << rt;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int x;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> x;
	cout << ((x < 1200) ? "ABC\n" : "ARC\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

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

    int x1 = scan.nextInt();
    int y1 = scan.nextInt();
    int x2 = scan.nextInt();
    int y2 = scan.nextInt();
    int dx = x2 - x1;
    int dy = y2 - y1;

    int x3 = x2 - dy;
    int y3 = y2 + dx;
    int x4 = x3 - dx;
    int y4 = y3 - dy;

    System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);

  }
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c,d,e;
	long double z,w;
	string str;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a;
	
	if(a==7||a==5||a==3){cout<<"YES";}
	else{cout<<"NO";}
	



	cout<<endl;
} 


Measured memory_bytes: 256
/*
    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;
//const int INF = 7 + (1e+9);

struct RollingHash
{
    typedef long long lint;
    const string str;
    const lint base, mod;
    vector<lint> hash, pw;

    RollingHash(const string &s, lint h = 1000000007, lint b = 1009) : str(s), mod(h), base(b)
    {
        int l = s.length();
        hash.assign(l + 1, 0);
        pw.assign(l + 1, 0);
        pw[0] = 1;
        for (int i = 0; i < l; ++i)
        {
            pw[i + 1] = pw[i] * base % mod;
            hash[i + 1] = (hash[i] * base + s[i]) % mod;
        }
    }

    lint const get_hash(int l, int r)
    {
        return ((hash[r] - hash[l] * pw[r - l]) % mod + mod) % mod;
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    ll R = 0;
    ll L = 0;
    RollingHash tree(s);
    RollingHash tree2(s, 999999937LL, 1009);

    set<pair<ll, ll>> se;
    rep(i, k)
    {
        string t;
        cin >> t;
        if (t == "R++")
        {
            R++;
        }
        else if (t == "R--")
        {
            R--;
        }
        else if (t == "L++")
        {
            L++;
        }
        else if (t == "L--")
        {
            L--;
        }

        se.insert({tree.get_hash(L,R+1),tree2.get_hash(L,R+1)});
        // cout<<tree.get_hash(L, R + 1)<<endl;
    }
    cout << se.size() << endl;
}



Measured memory_bytes: 31320
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  string s, t;

  cin >> s >> t;

  unordered_map<int, vector<int> > um;
  for (size_t i = 0; i < s.size(); i++) {
    int c_i = s[i] - '0';
    um[c_i].emplace_back(i);
  }

  ll ans = 0;
  ll curpos = 0;
  for (size_t j = 0; j < t.size(); j++) {
    int d_j = t[j] - '0';
    if(um[d_j].empty()){
      ans = -1;
      break;
    }
    auto lb = lower_bound(um[d_j].begin(), um[d_j].end(), curpos);
    if(lb == um[d_j].end()){
      curpos = 0;
      ans += (ll)s.size();
      j--;
    } else {
      curpos = (ll)(*lb) + 1;
      if (j == t.size() - 1) {
        ans += curpos;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

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; }


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

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

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

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

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

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

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

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

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


struct edge { int to, cost; };
ostream& operator<<(ostream& os, const edge& e) {
    os << "(" << e.to << ", " << e.cost << ")";
    return os;
}

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

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

    cout << min(b, a*n) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

vector<pair<int,int> >sp;

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

int n;

bool dfs(int x,int y,int t){

	if(t>=0 && (abs(x-sp[t].first)>1 || abs(y-sp[t].second)>1))return false;
	if(t==n-1)return true;

	for(int i=0;i<12;i++){
		int nx=x+dx[i],ny=y+dy[i];
		if(nx<0 || ny<0 || 9<nx || 9<ny)continue;
		if(dfs(nx,ny,t+1))return true;
	}
	return false;
}

int main(void){

	int x,y;
	while(cin >> x >> y,x|y){
		cin >> n;
		sp.resize(n);
		for(int i=0;i<n;i++)cin >> sp[i].first >> sp[i].second;
		if(dfs(x,y,-1))cout << "OK" << endl;
		else cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 1188
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 9 2 3");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("10 40 6 8");
            //23
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("314159265358979323 846264338327950288 419716939 937510582");
            //532105071133627368
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        long[] wkArr = InputList[0].Split(' ').Select(X => long.Parse(X)).ToArray();

        long A = wkArr[0];
        long B = wkArr[1];
        long C = wkArr[2];
        long D = wkArr[3];
        long LCM = C * D / DeriveGCD(C, D);

        //A以上B以下のCの倍数
        long Cnt1 = DeriveBaisuuCnt(A, B, C);
        //A以上B以下のDの倍数
        long Cnt2 = DeriveBaisuuCnt(A, B, D);
        //A以上B以下のCとDの公倍数
        long Cnt3 = DeriveBaisuuCnt(A, B, LCM);

        Console.WriteLine(B - A + 1 - Cnt1 - Cnt2 + Cnt3);
    }

    //p1以上p2以下のp3の倍数の数を返す
    static long DeriveBaisuuCnt(long p1, long p2, long p3)
    {
        long N1;
        if (p1 % p3 == 0) {
            N1 = p1 / p3;
        }
        else {
            N1 = p1 / p3 + 1;
        }

        long N2 = p2 / p3;

        return N2 - N1 + 1;
    }

    //ユークリッドの互除法で2数の最大公約数を求める
    static long DeriveGCD(long pVal1, long pVal2)
    {
        long WarareruKazu = pVal2;
        long WaruKazu = pVal1;

        while (true) {
            long Amari = WarareruKazu % WaruKazu;
            if (Amari == 0) return WaruKazu;
            WarareruKazu = WaruKazu;
            WaruKazu = Amari;
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
#include<string.h>
int main(void)
{
	int x, y, z,count=0;
	scanf("%d%d%d", &x, &y, &z);
	if (z == x + y)
		count++;
	if (x == y + z)
		count++;
	if (y == x + z)
		count++;
	if (count > 0)
		printf("Yes");
	else
		printf("No");
return 0;
}


Measured memory_bytes: 128
// #include "coins.h"
#include <iostream>
#include <numeric>
#include <vector>
#include <iomanip>

#include <iterator>

using Probabilities = std::vector<double>;

/*There are two possible ways to get exactly j heads with i coins -

a) if (i-1) coins have j heads, and ith coin is tail, and

b) if (i-1) coins have j-1 heads, and ith coin is head

so

P(i, j) = P(i-1, j) * (1 - p[i]) + P(i-1, j-1) * p[i]*/
double probability_of_more_heads(const Probabilities& heads_probabilities)
{
    std::vector<double> prev(heads_probabilities.size() + 1, 0);
    // dp[i] - probability that we have i heads so far
    std::vector<double> dp(heads_probabilities.size() + 1, 0);

    prev.front() = 1;

    for (size_t pos = 1; pos <= heads_probabilities.size(); ++pos) {
        for (size_t num_heads = 0; num_heads <= pos; ++num_heads) {
            const double p_heads{heads_probabilities[pos - 1]};
            const double p_tails{1 - p_heads};
            if (num_heads == 0)
                dp[num_heads] = prev[num_heads] * p_tails;
            else
                dp[num_heads] = prev[num_heads] * p_tails + prev[num_heads - 1] * p_heads;
        }
        std::swap(prev, dp);
    }

    return std::accumulate(
        std::next(prev.cbegin(), prev.size() / 2),
        prev.cend(),
        double{0.0});
}

int main(int argc, char* argv[])
{
    size_t num_coins;
    std::cin >> num_coins;
    Probabilities heads_probabilities(num_coins);
    for (size_t i = 0; i < num_coins; ++i) {
        double p_heads;
        std::cin >> p_heads;
        heads_probabilities[i] = p_heads;
    }
    std::cout << std::fixed << std::setprecision(10) << probability_of_more_heads(heads_probabilities) << std::endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,X,Y;
  cin >> N >> K >> X >> Y;
  int sum;
  if(N > K){
    sum = K * X;
  sum = sum + Y * (N - K);
    cout << sum << endl;
  }
  if(N <= K){
      sum = N * X;
    cout << sum << endl;
  }    
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;cin>>N;
    vector<int>L(N);rep(i,N)cin>>L[i];
    sort(all(L));
    if(accumulate(L.begin(),L.begin()+N-1,0ll)>L[N-1])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

int n,m;
vi a;

int solve(){
    int ans=0;
    vi b(all(a));
    map<int,int> t;
    vector<bool> v(n);
    SORT(b);
    rep(i,n)t[b[i]]=i;
    rep(i,n){
        if(v[i])continue;
        int j=i;
        int s=0;
        int mm=10000;
        int nn=0;
        while(true){
            v[j]=true;
            nn++;
            int x=a[j];
            mm=min(mm,x);
            s+=x;
            j=t[x];
            if(v[j])break;
        }
        ans+=s+min((nn-2)*mm,mm+(nn+1)*m);
    }
    return ans;
}

void run(){
    cin>>n;
    a=vi(n);
    rep(i,n)cin>>a[i];
    m=*min_element(all(a));
    cout<<solve()<<endl;
}


Measured memory_bytes: 3308
#include<map>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int c[9];
int ct;
void fn(map<pair<pair<int,int>,pair<int,int> >,int> a){
  while(a.empty()==0){
    c[(*a.begin()).second]=ct;
    ct++;
    int y=(*a.begin()).first.second.second;
    unsigned x=-1;
    map<pair<pair<int,int>,pair<int,int> >,int>::iterator it;
    for(it=a.begin();it!=a.end();it++){
      if((*it).first.first.second<y&&(*it).first.second.second>y)
	x=min(x,(unsigned)(*it).first.first.first);
    }    
    a.erase(a.begin());
    map<pair<pair<int,int>,pair<int,int> >,int> b;
    for(it=a.begin();it!=a.end();it++){
      if((unsigned)(*it).first.second.first<=x&&(*it).first.second.second<=y){
	b[(*it).first]=(*it).second;
	a.erase(it);
      }
    }
    fn(b);
  }
  return;
}
int main(){
  int h=0,i;
  int n;
  while(cin>>n&&n){
    if(h)
      cout<<endl;
    else
      h=1;
    map<pair<pair<int,int>,pair<int,int> >,int> a;
    for(i=0;i<n;i++){
      int p,q,r,s;
      cin>>p>>q>>r>>s;
      a[make_pair(make_pair(p,q),make_pair(r,s))]=i;
    }
    ct=1;
    fn(a);
    for(i=0;i<n;i++)
      cout<<c[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  char s[3][11];
  scanf("%s%s%s", s[0], s[1], s[2]);
  printf("%c%c%c\n", s[0][0] ^ 32, s[1][0] ^ 32, s[2][0] ^ 32);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
 
int main() {
  int n,m;
  cin >> n >> m;
  
  unordered_map<int,int> prob;
  
  int p;
  string s;
  
  int correct=0,penalty=0;
  
  rep(i,m){
    cin >> p >> s;
    
    if(s=="AC"){
      if(prob[p]!=-1){ //初めて正解した
        penalty += prob[p];
        correct += 1;
        prob[p]=-1;
      }
    }
    if(s=="WA"){
      if(prob[p]!=-1){ //まだ正解していないでWA
        prob[p] += 1;
      }
    }
  }
  cout << correct << ' ' << penalty << endl;
  
}



Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    string S;
    cin >> S;
    int num = 0;
    num = S.length();
    int sum = 0;

    for(int i = 0; i < num; i++) {
        if(i % 2 == 1 && (S[i] == 'L' || S[i] == 'U' || S[i] == 'D')) {
            sum++;
        } else if(i % 2 == 0 && (S[i] == 'R' || S[i] == 'U' || S[i] == 'D')) {
            sum++;
        }
    }

    if(sum == num) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    cin >> A;
    for (int i = 0; i + K < N; i++) {
        if (A[i] < A[i + K]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

int main(){
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    for (int i=0; i<N; i++) {
        cout << S.at(i) << T.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
color=[0]*8
free=0
for a in A:
    if 1<=a<=399:color[0]=1
    elif 400<=a<=799:color[1]=1
    elif 800<=a<1199:color[2]=1
    elif 1200<=a<=1599:color[3]=1
    elif 1600<=a<=1999:color[4]=1
    elif 2000<=a<=2399:color[5]=1
    elif 2400<=a<=2799:color[6]=1
    elif 2800<=a<=3199:color[7]=1
    elif 3200<=a<=4800:free+=1
M=sum(color)+free
m=1 if sum(color)==0 and free!=0 else sum(color)
print(m,M)

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

int cnt = 0;
int m = 1;
vector<int> G = {1};

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

void shellSort(int A[], int n) {
  cnt = 0;

  // 数列Gを作成
  int g = 1;
  while (g < n) {
    g = 3 * g + 1;
    if (g < n) {
      G.push_back(g);
      m++;
    }
  }

  for (int i = m - 1; i >= 0; i--) {
    insertionSort(A, n, G[i]);
  }
}

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

  int a[n];
  rep(i, n) cin >> a[i];

  shellSort(a, n);
  cout << m << endl;
  for (int i = m - 1; i >= 0; i--) {
    cout << G[i];
    if (i > 0) cout << " ";
  }
  cout << endl;
  cout << cnt << endl;
  rep(i, n) cout << a[i] << endl;

  return 0;
}


Measured memory_bytes: 7052
#include <iostream>
#include <string>
#include <string.h>
using namespace std;



int main(){

    int X, A;
    cin >> X >> A;

    if(X<A)cout << "0\n";
    else cout << "10\n";

    return 0;
}

//g++ ファイル名 --input-charset=utf-8 --exec-charset=cp932
//日本語出力するときのやつ

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define F first
#define S second
 
#define ler freopen("inspection.in","r",stdin);freopen("inspection.out","w",stdout)
#define fastio ios::sync_with_stdio(0), cin.tie(0)
#define rep(i,a,b) for(int i=a; i<b; i++)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()
#define sz(a) ((int)(a).size())
#define debug cout<<"ACM ICPC\n"
 
#define pdd pair<ld,ld> 
#define ll long long
#define ld long double
#define vi vector<int> 
#define pii pair<int,int>  
 
#define MAXN 1000000
#define LOG 21
#define EPS 1e-6
#define INF 1e12L

int n=3, v[3][3], a[3], b[3];
bool ans=false;

int main(){
	rep(i,0,n) rep(j,0,n) cin >> v[i][j];
	
	for(int i=0; i<=100; i++){
		a[0]= i;
		
		rep(j,0,3) b[j]= v[0][j] - a[0]; 
		rep(j,1,3) a[j]= v[j][0] - b[0];
		
		bool flag= true;
		rep(j,0,3) rep(k,0,3) if(v[j][k]!=a[j]+b[k] || a[j]>100 || a[j]<0 || b[k]>100 || b[k]<0) flag= false;
		if(flag) ans=true;
	}
	
	if(ans) cout << "Yes\n";
	else cout << "No\n";
}









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

#define P_MAX (200000)
bool notPrime[P_MAX] = {false, false, false};

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

	unsigned int sq = sqrt(P_MAX)+1;
	for (unsigned int i = 2; i <= sq; i++) {
		if (!notPrime[i]) {
			for (unsigned int j = i+i; j < P_MAX; j+=i) {
				notPrime[j] = true;
			}
		}
	}

	for (unsigned int i = X; i < P_MAX; i++) {
		if (!notPrime[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 512
import sys
from itertools import accumulate
import bisect

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    s = sum(i*(N//i)*(N//i+1)//2 for i in range(1, N+1))
    print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67352
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){ 
    int f;
    cin>>f;
    cout<<f/2-15<<endl;
    
}


/*
abcde

/root
a.txt
bunp.html
/desktop
r.txt
fsharp.cs
dp.cpp
/users
bison.txt

root r.txt
users r.txt
users a.txt

desktop/r.txt
../r.txt
../../a.txt
*/



Measured memory_bytes: 3100
#define RUN
#ifdef RUN
#include <bits/stdc++.h>
using namespace std;

int H, N;
int S;

int main() {
    cin >> H >> N;
    for (int i = 0; i < N; ++i) {
        int s;
        cin >> s;
        S += s;
    }
    cout << ((H <= S) ? string("Yes") : string("No")) << endl;
    return 0;
}
#endif


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

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;}

signed main() {
    int h, w;
    cin >> h >> w;

    vector<string> vs;

    rep(i, h) {
        string s;
        cin >> s;

        vs.push_back(s);
    }

    int ans = 0;

    rep(i, h * w) {
        if (vs[i / w][i % w] == '#') continue;
        vector<int> vi(h * w, -1);
        queue<int> bfs;
        int cnt = 0;
        bfs.push(i);
        vi[i] = 0;
        int max = 0;

        do {
            int pos = bfs.front();
            bfs.pop();
            int sx = pos % w;
            int sy = pos / w;
            chmax(max, vi[pos]);

            if (sx > 0 && vs[sy][sx - 1] == '.' && vi[pos - 1] == -1) {
                bfs.push(pos - 1);
                vi[pos - 1] = vi[pos] + 1;
            }
            if (sx < w - 1 && vs[sy][sx + 1] == '.' && vi[pos + 1] == -1) {
                bfs.push(pos + 1);
                vi[pos + 1] = vi[pos] + 1;
            }
            if (sy > 0 && vs[sy - 1][sx] == '.' && vi[pos - w] == -1) {
                bfs.push(pos - w);
                vi[pos - w] = vi[pos] + 1;
            }
            if (sy < h - 1 && vs[sy + 1][sx] == '.' && vi[pos + w] == -1) {
                bfs.push(pos + w);
                vi[pos + w] = vi[pos] + 1;
            }
        } while(!bfs.empty());

        chmax(ans, max);
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define lc c[x][0]
#define rc c[x][1]
#define pb push_back
int cnt[13],D[52],d[52],n,ans=0;
int cal(int a,int b){
    if (a<=0&&b<=0) a*=-1,b*=-1;
    if (a>b) swap(a,b);
    if (a<0) return min(b-a,24-(b-a));
     else return (b-a);
}
void dfs(int i){
    if (i==n+1){
        int j,k,mx=24;
        for (j=0;j<=n;j++)
         for (k=j+1;k<=n;k++)
          mx=min(mx,cal(d[j],d[k]));
        ans=max(ans,mx);
        return;
    }
    d[i]=D[i];dfs(i+1);
    d[i]=-D[i];dfs(i+1);
}
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int i;
    cin>>n;cnt[0]++;
    for (i=1;i<=n;i++){
        scanf("%d",&D[i]);
        cnt[D[i]]++;
    }
    if (cnt[0]>1||cnt[12]>1) {puts("0");return 0;}
    for (i=1;i<=11;i++) if (cnt[i]>2) {puts("0");return 0;}
    for (i=1;i<=11;i++) if (cnt[i]==2) if (cnt[i-1]>0||cnt[i+1]>0) {puts("1");return 0;}

    d[0]=0;dfs(1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Collections;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        ArrayList <Integer> cakes = new ArrayList<Integer>();
        int stack = 1;

        int num = in.nextInt();

        for (int i = 0; i < num ; i++)
        {
            cakes.add(in.nextInt());
        }
        Collections.sort(cakes);
        Collections.reverse(cakes);
        int check = cakes.get(0);
        for (int i = 1; i < cakes.size(); i++) {
            if (cakes.get(i) != check) {
                check = cakes.get(i);
                stack++;
            }
        }
System.out.println(stack);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

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

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

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

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

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

Measured memory_bytes: 21332
import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        for(int i = 0 ; i < s.length() ; i ++){
            if(i % 2 == 0){
                System.out.print(s.charAt(i));
            }
        }
    }
}

Measured memory_bytes: 29488
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    ll a, b;
    ll ans = 0;

    cin >> a >> b;

    if(a > b){
        for(ll i = 0; i < a; i++){
            cout << b;
        }
    }else{
        for(ll i = 0; i < b; i++){
            cout << a;
        }
    }

    cout << endl;

    return 0;
}


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

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

    vector<int> A(N+2);
    A[0] = 0;
    rep(i, N) {
        cin >> A[i+1];
    }
    A[N+1] = 0;

    vector<int> S(N+2);
    S[0] = 0;
    rep(i, N + 1) {
        S[i+1] = S[i] + abs(A[i+1] - A[i]);
    }

    int ans = 0;

    rep(i, N) {
        cout << S[N+1] - (S[i+2] - S[i]) + abs(A[i+2] - A[i]) << endl;
    }

}


Measured memory_bytes: 3984