akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  map<int,int> R;
  R[0] = 1;
  int t = 0;
  long long ans = 0;
  for(int i = 0; i < N; ++i){
    t += A[i]%M;
    t %= M;
    ans += R[t];
    ++R[t];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3584
n, k =gets.chomp.split(' ').map(&:to_i)
r = 1.to_f/n
s = 0

(1..n).each do |i|
  t = r
  if i < k
    while i < k
      t = t * 0.5
      i = i * 2
    end
  end
  s += t 
end

print("#{s}\n")

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

int main() {
  string S; cin>>S;
  if (S=="SUN") cout<<7<<endl;
  if (S=="MON") cout<<6<<endl;
  if (S=="TUE") cout<<5<<endl;
  if (S=="WED") cout<<4<<endl;
  if (S=="THU") cout<<3<<endl;
  if (S=="FRI") cout<<2<<endl;
  if (S=="SAT") cout<<1<<endl;
}

Measured memory_bytes: 256
O = input()
E = input()

num = len(O) + len(E)
password =''
for i in range(1, num+1):
  if i % 2 ==0:
    n = i // 2
    password += E[n-1]
  else:
    n = i // 2 + 1
    password += O[n-1]
print(password)

Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

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

    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int N;
    cin >> N;
    vector<pair<int, int>> P;
    rep(i, N) {
        int p;
        cin >> p;
        P.push_back({p, i + 1});
    }

    sort(ALL(P), greater<pair<int, int>>());
    multiset<int> st{0, 0, N + 1, N + 1};

    ll ret = 0;
    for(auto p : P) {
        ll num = p.first;
        int idx = p.second;
        auto it = st.lower_bound(idx);
        int R1 = *it;
        int R2 = *next(it);
        int L1 = *prev(it);
        int L2 = *prev(it, 2);
        ret += num * (R2 - R1) * (idx - L1);
        ret += num * (R1 - idx) * (L1 - L2);
        st.insert(idx);
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 5748
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main() {
    set <string> strSet;
    int N;
    cin >> N;

    while (N--) {
        string str;
        cin >> str;
        strSet.insert(str);
    }

    cout << strSet.size() << endl;

    return 0;
}

Measured memory_bytes: 19224
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define in read()
#define re register
#define fur(i,a,b) for(re int i=a;i<=b;++i)
#define fdr(i,a,b) for(re int i=a;i>=b;--i)
#define cl(a,b) memset(a,b,sizeof(a))
#define jinitaimei signed
#define int long long
inline int read()
{
	int x=0;
	char ch=getchar();
	for(;!isalnum(ch);ch=getchar());
	for(;isalnum(ch);ch=getchar()) x=x*10+ch-'0';
	return x;
}
const int xx=2e5+101;
struct person
{
	int x,y;
}m[xx];
inline bool cmp(person a,person b)
{
	return a.x<b.x;
}
jinitaimei main()
{
	int n=in,xmax=0,xmin=2e18,ymax=0,ymin=2e18;
	fur(i,1,n)
	{
		m[i].x=in,m[i].y=in;
		if(m[i].x>m[i].y) swap(m[i].x,m[i].y);
		xmax=max(xmax,m[i].x);
		xmin=min(xmin,m[i].x);
		ymax=max(ymax,m[i].y);
		ymin=min(ymin,m[i].y);
	}
	int ans=(xmax-xmin)*(ymax-ymin);
	sort(m+1,m+n+1,cmp);
	ymin=xmin;
	int maxl=m[1].y,minl=m[1].y,ans2=2e18;
	fur(i,2,n-1)
	{
		maxl=max(maxl,m[i].y);
		minl=min(minl,m[i].y);
		ans2=min(ans2,max(maxl,m[n].x)-min(minl,m[i+1].x));
	}
	if(n>2) ans2*=(ymax-ymin);
	ans=min(ans,ans2);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3456
# https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_c

n = int(input())
s = input()

tot_w = s.count('.')

ret = tot_w  # 初期配置をすべて黒にした場合にして、左端から白を置いていく
w = 0
b = 0
for c in s:
    if c == '#':
        b += 1
    else:
        w += 1
    cost = b + tot_w - w
    ret = min(ret, cost)

print(ret)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }

int main() {
    string S;
    unsigned long long int K;
    cin >> S >> K;
    int ans = 0;
    rep(i, S.length()) {
        if(S[i] == '1') ++ans;
        else break;
    }

    if(ans >= K) cout << 1 << endl;
    else cout << S[ans] << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s, t;
  cin >> s >> t;
  t.erase(t.length() - 1);
  if(s == t){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#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++)
#define _GLIBCXX_DEBUG

int main(){
    int N;
    cin>>N;
    vector<int> vec(N);
    rep(i,N){
        cin>>vec[i];
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());

    int count=1;
    if(N==1) cout<<count<<endl;
    else
    {
        rep(i,N-1){
            if(vec[i+1]-vec[i]!=0) count++;
            else continue;
        }
        cout<<count<<endl;
    }
    

}

Measured memory_bytes: 3624
from collections import Counter
from collections import defaultdict
import sys

sdin = sys.stdin.readline

H,W,N = map(int, sdin().split())
AB = []
for i in range(N):
    AB.append(tuple(map(int, sdin().split())))
    
grid_num = (min(H,W)-2)*(max(H,W)-2)
    
AB = [(a-1,b-1) for a,b in AB]

dic = defaultdict(int)

for a,b in AB:
    for h in range(-1,2):
        if a+h < 1 or a+h > H-2:
            continue
        
        for w in range(-1,2):
            if b+w < 1 or b+w > W-2:
                continue
            
            dic[(a+h,b+w)] += 1
            

cnt = Counter(dic.values())

for i in range(10):
    if i==0:
        print(grid_num - sum(cnt.values()))
    elif not i in cnt.keys():
        print(0)
    else:
        print(cnt[i])

Measured memory_bytes: 180360
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	double s,ans=0;
	char c[5];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%lf %s",&s,c);
		if(c[0]=='B')
			ans+=s*380000;
		else
			ans+=s;
	}
	printf("%.5lf",ans);
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize(2) 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define clr(a,b) memset(a,b,sizeof(a))

ll n,m,k,ans;
char c[10005];
ll p,q,r;
int main(){
	//freopen("P1429_6.in","r",stdin);
	//freopen("match.out","w",stdout);
    ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>c[i];
		if(c[i]=='R')p++;
		if(c[i]=='G')q++;
		if(c[i]=='B')r++;
	}
	ans=p*q*r;
	for(int i=1;i<=n;i++){
		for(int d=1;i+2*d<=n;d++){
			int j=i+d,k=i+2*d;
			if(c[i]!=c[j]&&c[j]!=c[k]&&c[k]!=c[i])ans--;
		}
	}
	cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<functional>
#include<algorithm>

using namespace std;

int main(){
	int n;
	int d[110];
	cin >> n;
	for(int i=0; i<n; i++){
	    cin >> d[i];
	}
	sort(d,d+n,greater<int>());
	int ans=1;
	for(int i=0; i<n-1; i++){
	    if(d[i]!=d[i+1])
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a=[0]
a.extend(list(map(int,input().split())))
a.append(0)
t=0
no=0
for i in a:
    t+=abs(no-i)
    no=i
for k in range(n):
    i=k+1
    s=(abs(a[i-1]-a[i+1]))-(abs(a[i-1]-a[i])+abs(a[i]-a[i+1]))
    print(t+s)


Measured memory_bytes: 13920
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int size = str.length() - 2;
        System.out.println(str.substring(0, 1) + size + str.substring(str.length() - 1));
    }
}

Measured memory_bytes: 21972
package main

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

/* 一つ読み */
func scanText() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}

/* 複数読み */
func scanTextSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = scanText()
	}
	return a
}
func scanSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}
func scanFloatSlice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = scanFloat()
	}
	return a
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	t := scanText()
	// t := "aaa"
	x := 0
	for i := 0; i < len(t); i++ {
		// break
		if t[i] == '1' {
			x++
		}
	}
	fmt.Println(x)

}

Measured memory_bytes: 1772
#include <iostream>
#include <vector>
#include <stdio.h>

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

typedef long long ll;

using namespace std;

const int INF = 1e9;
const double PI=3.14159265358979323846;

int main(){
  int n;
  cin >> n;
  vector<int> vi(n);
  rep(i,n) cin >> vi[i];
  for(int i = n-1; i > 0; i--){
    cout << vi[i]  << " ";
  }
  cout << vi[0] << endl;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
 
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mp make_pair
#define mod 1000000007
#define qmod 998244353
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll LINF = LLONG_MAX;
int main(){
	faster;
	int n,m,c;
	cin>>n>>m>>c;
	int a[m],b[m];
	for(int i=0;i<m;i++){
		cin>>a[i];
	}
	int count=0;
	while(n--){
		int sum=0;
		for(int i=0;i<m;i++){
			cin>>b[i];
			sum += a[i]*b[i];
		}
		sum +=c;
		if(sum>0){
			count++;
		}
	}
	cout<<count<<endl;
}

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

int f_r(int d,int x){
	x=x+d;
	if(x>=600)return 0;
	return d*x*x+f_r(d,x);
}
int main(){
	int d;
	int s;
	while((scanf("%d",&d))!=EOF){
		
		s=f_r(d,0);
		printf("%d\n",s);
	}
	return 0;
}

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

int main(){
    int n=1000000;
    //cout<<"enter n";
    //cin>>n;
    bool prime[n+1];
    for(int i=2;i<=n;i++)
        prime[i]=true;
    for(int i=2;i*i<=n;i++){
        if(prime[i]==1){
            for(int j=i*i;j<=n;j+=i){
                prime[j]=false;
            }
        }
    }
    vector<ll>arr;
    for(int i=2;i<=n;i++){
        if(prime[i]==1){
            arr.push_back(i);
        }
    }
    ll x;
    cin>>x;
    for(int i=0;i<arr.size();i++){
        if(arr[i]>=x)
        {

            cout<<arr[i];
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
int main(){
  int ans=0;
  int a,b,c,k;
  cin >> a >> b>> c>> k;
  ans+=min(a,k);
  k-=min(a,k);
  k-=min(b,k);
  ans-=k;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define pb(a) push_back(a)
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}

int main()
{
    ll x;ll k;ll d;
    cin >> x >> k >> d;
    x=abs(x);
    ll amari=x%d;
    ll amari2=abs(amari-d);
    k-=(x/d);
    if(k<0){
        cout << x-d*(k+(x/d)) << endl;
    }
    else if(k%2==0){
        cout << amari << endl;
    }
    else{
        cout << amari2 << endl;
    }
}


Measured memory_bytes: 3672
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

i64 A, B, C, K;

int main()
{
	scanf("%lld%lld%lld%lld", &A, &B, &C, &K);

	i64 ans = A - B;
	if (K % 2 == 1) ans = -ans;
	printf("%lld\n", ans);

	return 0;
}


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define pb push_back
#define f first
#define s second
#define INF 1000000000000
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 100100, MAXK = 25;
const ll MOD = 1e9+7;

ll dp[MAXN][3];
ll a[MAXN], b[MAXN], c[MAXN];

int main()
{
    FAST_IO;

    int n; cin >> n;
    FOR(i, 1, n) cin >> a[i] >> b[i] >> c[i];

    FOR(i, 1, n) {
        dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;

    return 0;
}


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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long ll;

int n;
ll a[3005];
ll memo[3005][3005];

ll dp(int i, int j){
	if(j < i)	return 0;
	if(i == j)	return a[i];
	if(i + 1 == j)	return max(a[i] - a[j], a[j] - a[i]);
	if(memo[i][j] != -1)	return memo[i][j];
	return memo[i][j] =  max(min(a[j] - a[i] + dp(i+1, j-1), a[j] - a[j-1] + dp(i, j-2)), min(a[i] - a[j] + dp(i+1, j-1), a[i] - a[i+1] + dp(i+2, j)));	
}

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

	memset(memo, -1, sizeof(memo));

	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}

	cout << dp(0, n-1);
	
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  string s;
  cin >> s;
  int r=0,b=0;
  for(int i=0;i<N;i++){
    if(s[i]=='R'){r++;}
    else{b++;}
  }
  if(r>b){cout << "Yes" << endl;}
  else{cout << "No" << endl;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
using namespace std;
typedef long long LL;
int main(){
	int n,a,b;scanf("%d%d%d",&n,&a,&b);
	if((n==1&&a!=b)||(a>b)){
		printf("0\n");
		return 0;
	}
	printf("%lld\n",(n-1)*1ll*b+a-((n-1)*1ll*a+b)+1);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<Pi,int> Pii;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n;
	ll x[200001];
	ll c[200001]={};
	ll r=0;

	cin>>n;

	r=n/2;
	rep(i,n){
		cin>>x[i];
		c[i]=x[i];
	}
	sort(c,c+n);

	for(ll j=0; j<n; j++){
		if(x[j]>=c[n-r]){
			cout<<c[n-r-1]<<endl;
		}else{
			cout<<c[n-r]<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5376
#include <iostream>
using namespace std;
char p;
int l, lp;
long long r;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  for(char c: s) {
    if(c != p) {
      if(c == '<')
        r -= l < lp ? l : lp;
      p = c; lp = l; l = 0;
    }
    r += ++l;
  }
  if(p == '>')
    r -= l < lp ? l : lp;
  cout << r << '\n';
  return 0;
}


Measured memory_bytes: 1172
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	vector<int> bell(3);
	cin >> bell[0] >> bell[1] >> bell[2];
	
	sort(bell.begin(), bell.end());
	
	cout << bell[0] + bell[1] << endl;
	
	return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    int n, ctr = 0;
    cin>>n;
    vector<int> A(n);
    for (int i = 0; i < n; i++)
        cin>>A[i];
    sort(A.begin(), A.end());
    for(int i = n-1; i >= 1; i--){
        int l = 0, r = i-1;
        while( l < r){
            if( A[l] + A[r] > A[i]){
                ctr += r - l ;
                r--;
            }
            else
                l++;
        }
    }

    cout<<ctr;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n,k;
    cin>>n>>k;
    if(n%k==0)
        cout<<"0\n";
    else
        cout<<"1\n";
    return 0;
}


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

#define loop(i)    for(int lp=0; lp<(i); lp ++)
#define ascent(i,a,b) for(int i=(a); i<(b); i ++)

#define pb push_back

using namespace std;

int m, n;

int max(vector<int> vec) {
	int max = 0;
	ascent(i, 0, n) {
		if(max < vec[i]) max = vec[i];
	}
	
	return max;
}

int main() {
	vector<int> a;
	
	while(cin >> m >> n, m||n) {		
		a.clear();
		int tmp;
		loop(n) {
			cin >> tmp;
			a.pb(tmp);
		}
		
		int l=0, r=0;
		ascent(i,0,n) {
			r+= a[i];
		}
		int ans = r;
		int mid;
		while(r-l>1) {
			mid = (l+r)/2;
			
			if(mid < max(a)) {
				l = mid;
			}
			else {
				int count = m-1;
				int a_sum = 0;
				vector<int> tmpvec;
				for(int i=0; i<n; i++) {
					if(a_sum + a[i] > mid) {
						tmpvec.pb(a_sum);
						a_sum = a[i];
						count --;
					}
					else {
						a_sum += a[i];
					}
				}
//				tmpvec.pb(a_sum);
//				cout << mid << " " << count << endl;
//				ascent(i, 0, tmpvec.size()) {
//					cout << " " << tmpvec[i];
//				}
//				cout << endl;
				
				if(count >= 0) {
					ans = mid;
				}
				
				if(count == m || count < 0) l=mid;
				else r=mid;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

const int INF = 1001001001;

int main() {
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> A(n+1, 0), B(n+1, 0);
    int p = -INF;
    rep(i, n) {
        A[i+1] = A[i];
        if (s[i] == 'o' && p+c < i) {
            p = i;
            A[i+1]++;
        }
    }
    p = INF;
    for (int i = n-1; i >= 1; --i) {
        B[i-1] = B[i];
        if (s[i] == 'o' && p-c > i) {
            p = i;
            B[i-1]++;
        }
    }
    vector<int> ans;
    auto r_search = [&](int a) {
        int l = -1;
        int r = n;
        while (r-l > 1) {
            int m = (l+r) / 2;
            if (B[m] >= a) l = m;
            else r = m;
        }
        return l; 
    };
    rep(i, n) {
        if (s[i] == 'x') continue;
        int t = A[i] + B[i];
        int l = lower_bound(A.begin(), A.end(), A[i]) - A.begin();
        int r = r_search(B[i]);
        if (A[i] == 0) l = -INF;
        if (B[i] == 0) r = INF;
        if (c >= r-l+2) t--;
        if (t < k) {
            ans.push_back(i+1);
        }
    }
    for (int x: ans) {
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 6008
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define V vector<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int A, B, C, D;  cin >> A >> B >> C >> D;
    while(A > 0 && C > 0){
      C -= B;
      if(C <= 0){  cout << "Yes" << endl;  return 0;  }
      A -= D;
      if(A <= 0){  cout << "No" << endl;}
    }
  	return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double d = sc.nextDouble();
		double t = sc.nextDouble();
		double s = sc.nextDouble();

		double ans = d / s;


		if(ans <= t) {
			System.out.println("Yes");
		} else {
			System.out.println("No");

		}

	}

}

Measured memory_bytes: 37196
n=int(input())
b=[int(i) for i in input().split()]
a=[0]*n
a[0]=b[0]
a[-1]=b[-1]
for i in range(1,n-1):
    if b[i]>b[i-1]:
        a[i]=b[i-1]
    else:
        a[i]=b[i]
print(sum(a)) 

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

const int mod = 1000000007;

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

    int n;
    cin >> n;

    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    ll ans = 0;
    
    for(int i = 0; i < 60; i++){
        ll x = 0;
        for(int j = 0; j < n; j++){
            if(a[j]>>i&1) x++;
        }
        ll add = x * (n - x) % mod;
        for(int j = 0; j < i; j++){
            add = add * 2 % mod;
        }
        ans += add;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

const ll mod = 998244353;

const ll INF = 1e15;

int main() {
	ll n;
	cin >> n;
	vector<string> vs(n);
	rep(i, n) {
		cin >> vs[i];
	}
	ll current = 0;
	vector<P> up;
	vector<P> low;
	ll total = 0;
	rep(i, n) {
		int length = vs[i].size();		
		ll c = 0;
		ll lower = 0;
		rep(j, length) {
			if (vs[i][j] == '(') {
				c++;
			}
			else {
				c--;
			}
			lower = min(lower, c);
		}
		total += c;
		if (c >= 0) {
			up.emplace_back(lower, c);
		}
		else {
			low.emplace_back(lower - c, -c);
		}
	}
	if (total != 0) {
		cout << "No" << endl;
		return 0;
	}
	sort(up.begin(), up.end(), std::greater<P>());
	sort(low.begin(), low.end(), std::greater<P>());
	ll h = 0;
	for (auto p : up) {
		ll lower = h + p.first;
		if (lower < 0) {
			cout << "No" << endl;
			return 0;
		}
		h += p.second;
	}
	h = 0;
	for (auto p : low) {
		ll lower = h + p.first;
		if (lower < 0) {
			cout << "No" << endl;
			return 0;
		}
		h += p.second;
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 50352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
#include <unordered_map>
using namespace std;

const unsigned long long BASE = 1e9 + 7;
#define SAFE 1e8

int main()
{
    int k;
    cin >> k;
    int mod = 7;
    bool has[1000001];
    for (int i = 0; i < 1000001; i++)
        has[i] = false;
    has[mod] = true;
    int count = 1;
    while (mod % k != 0)
    {
        mod = (7 + mod * 10) % k;
        //cout << mod << endl;
        if (has[mod])
        {
            cout << -1 << endl;
            return 0;
        }
        has[mod] = true;
        count++;
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 4648
#include <iostream>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  int ans = A + B;
  if(A % 3 == 0 || B % 3 == 0 || ans % 3 == 0){
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
 
int dp[100019];
int32_t main()
{
    IOS
    
    int n,w;
    cin>>n>>w;
    int a[n],b[n];
    for(int i=0;i<n;++i)
        cin>>a[i]>>b[i];
    for(int i=1;i<=100010;++i)
        dp[i]=100000000000;
    dp[0]=0;
    for(int i=1;i<=n;++i)
    {
        //dp[b[i-1]]=min(dp[b[i-1]],a[i-1]);
        for(int j=100000;j>=b[i-1];--j)
        {
 
            dp[j]=min(dp[j],dp[j-b[i-1]]+a[i-1]);
        }
        
    }
    int ans=0;
    for(int i=0;i<=100000;++i)
    {
        if(dp[i]<=w)
            ans=i;
    }
    cout<<ans;
 
 
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;
int main() {
    int n, d;
    cin >> n >> d;
    int x[10][10];

    int temp;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> temp;
            x[i][j] = temp;
        }
    }

    int ans = 0;
    double mass;
    int check;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            mass = 0;
            for (int k = 0; k < d; k++) {
                mass += pow(x[i][k] - x[j][k], 2);
            }
            check = powf(mass, 0.5);
            if (pow(mass, 0.5) - check < 0.000001) {
                ans++;
            }
        }
    }
    cout << (ans - n) / 2;
    
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

vector<string> v;
int n;
void dfs(string s, int x){
    if(s.size() == n){
        v.push_back(s);
        return;
    }
    rep(i,x+2){
        string ss = s;
        ss += (char)(i + 'a');
        int y = max(x, i);
        dfs(ss, y);
    }
}

int main() {
    cin >> n;
    string t;
    dfs(t,-1);

    sort(v.begin(), v.end());
    rep(i,v.size()){
        cout << v[i] << endl;
    }
    return 0;
}
 
 


Measured memory_bytes: 7796
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


int n, a,b,c,d;
string s;

int main(){
	cin >> n >> a >> b >> c >> d;
	cin >> s;
	
	bool can = 1;
	bool side = 0;
	if(c < d){
		for(int i = a; i < c; i++){
			if(s[i] == '#' && s[i+1] == '#'){
				can = 0;
			}
		}
		for(int i = b; i < d; i++){
			if(s[i] == '#' && s[i+1] == '#'){
				can = 0;
			}
		}
		if(can){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	else{
		for(int i = b-1; i < d; i++){
			if(s[i] == '#' && s[i+1] == '#'){
				can = 0;
			}
			if(s[i] != '#' && s[i-1] != '#' && s[i+1] != '#'){
				side = 1;
			}
		}
		for(int i = a; i < c; i++){
			if(s[i] == '#' && s[i+1] == '#'){
				can = 0;
			}
		}
		if(can && side){
			cout << "Yes" <<  endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 5;
int main() {
	int n;
	cin >> n;
	vector <int> dp(3, 0);
	vector <int> new_dp(3, 0);
	vector <int> a(n);
	for(int i = 0; i < n; ++i) {
		for(int z = 0; z < 3; ++z) cin >> a[z]; 
		for(int j = 0; j < 3; ++j) {
			for(int k = 0; k < 3; ++k) {
				if(j != k) {
					new_dp[k] = max(new_dp[k], dp[j] + a[k]);
				}	
			} 
		}
		dp = new_dp;
	}
	cout << max(max(dp[0], dp[1]), dp[2]) << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define maxn 100005
using namespace std;

int arr[maxn], dp[maxn];
int n, k;

int dfs(int x) {
    if(~dp[x]) return dp[x];
    dp[x] = 0;
    for(int i = 0; i < n; i++) {
        if(x >= arr[i] && !dfs(x - arr[i])) {
            dp[x] = 1;
        }
    }
    return dp[x];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    memset(dp, -1, sizeof(dp));
    for(int i = 0; i < n; i++) cin >> arr[i];
    cout << (dfs(k) ? "First" : "Second") << '\n';
    return 0;
}


Measured memory_bytes: 8720
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
const int MOD = 1000000007;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
    int N;
    cin >> N;
    map<string, int> map;
    rep(i,N){
        string s;
        cin >> s;
        map[s]++;
    }
    int maxv = 0;
    for(auto x:map){
        int v = x.second;
        if(maxv<v){
            maxv = v;
        }
    }
    for (auto it = map.begin(); it != map.end();it++){
        if(it->second==maxv){
            cout << it->first << endl;
        }
    }
        return 0;
}

Measured memory_bytes: 19248
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int a,b;
  cin>>a>>b;
    if(a==b){
        cout<<"Draw";
    }else if(a==1){
        cout<<"Alice";
    }else if(b==1){
        cout<<"Bob";
    }else if(a>b){
        cout<<"Alice";
    }else{
        cout<<"Bob";
    }
    return 0;
}


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

using ll=long long;
const ll MOD=1e9+7;
int main(){
    int n;
    cin>>n;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    int ai=0,bi=0;
    int an=0;
    int bn=0;
    ll res=1;
    while(ai+bi<2*n){
        if(ai<n && (bi>=n || a[ai]<b[bi])){
            if(bn>0){
                res=(res*bn)%MOD;
                bn--;
            }
            else{
                an++;
            }
            ai++;
        }else{
            if(an>0){
                res=(res*an)%MOD;
                an--;
            }
            else{
                bn++;
            }
            bi++;
        }
    }
    cout<<res<<endl;
    return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    
    vector<int> H(N);
    
    for (int i = 0; i < N; i++) {
        cin >> H.at(i);
    }
    
    int past_max = 0;
    int prev = 0;
    for (int i = 0; i < N; i++) {
        int h = H.at(i);
        
        if (prev > h) {
            if (past_max - 1 != h) {
                cout << "No" << endl;
                return 0;
            }
        }
        
        past_max = max(past_max, h);
        prev = h;
    }
    
    cout << "Yes" << endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int n,m,seiz[220][2],data[1100][2],x,y,cnt,k;
int main(){
	while(1){
	cin>>m;
	if(m==0){
		break;
	}
	for(int i=0;i<m;i++){
		cin>>seiz[i][0]>>seiz[i][1];
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>data[i][0]>>data[i][1];
	}
	for(int i=0;i<n;i++){
		cnt=1;
		x=data[i][0]-seiz[0][0];
		y=data[i][1]-seiz[0][1];
		for(int j=1;j<m;j++){
			for(k=0;k<n;k++){
				if(k!=i && seiz[j][0]==(data[k][0]-x)){
					if(seiz[j][1]==(data[k][1]-y)){
						cnt++;
						break;
					}
				}
			}
					
		}
		if(cnt==m){
			break;
		}
	}
	cout<<x<<" "<<y<<endl;
	}
	return 0;
}

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

namespace CF2016F
{
    class B
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            List<long> list = new List<long>();
            long res = 0;
            for (int i = 1; i <= N; i++)
            {
                res += i;
                list.Add(i);
                if (N < res) break;
            }

            long sum = list.Sum();
            list.Remove(sum - N);

            foreach (var i in list)
            {
                Console.WriteLine(i);
            }
        }
    }
}


Measured memory_bytes: 13152
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

int h, w;

int sx, sy;
int gx, gy;
vector<int> x[3000];
vector<int> y[3000];
int n;
int memo[100][100];
int g[100][100];

int solve(int ny, int nx){
  if(memo[ny][nx] != -1)
    return memo[ny][nx];
  
  int now = g[ny][nx];

  if(now == n) return 0;

  int ret = 1 << 30;
  int nn = x[now + 1].size();

  REP(i,nn){
    int nnx = x[now + 1][i];
    int nny = y[now + 1][i];
    if(g[nny][nnx] != now + 1){
      while(true);
    }
    ret = min(ret, abs(nx - nnx) + abs(ny - nny) + solve(nny, nnx));
  }

  return memo[ny][nx] = ret;
}

int main(){
  while(cin >> w >> h, w + h){
    n = 0;

    REP(i,3000){
      x[i] = vector<int>();
      y[i] = vector<int>();
    }

    REP(i, h){
      REP(j, w){
	string s;
	cin >> s;

	if(s != "."){
	  if(s == "S"){
	    sx = j; sy = i;
	  }else if(s == "G"){
	    gx = j; gy = i;
	  }else{
	    int num;
	    sscanf(s.c_str(), "%d", &num);
	    g[i][j] = num;
	    n = max(num, n);
	    x[num].push_back(j);
	    y[num].push_back(i);
	  }
	}
      }
    }

    x[0].push_back(sx);
    y[0].push_back(sy);
    n++;
    x[n].push_back(gx);
    y[n].push_back(gy);
    g[sy][sx] = 0;
    g[gy][gx] = n;

    memset(memo, -1, sizeof(memo));
    int ret = solve(sy, sx);

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

Measured memory_bytes: 0
#include <stdio.h>
int main(void)
{
  int A,B,result;
  scanf ("%d %d",&A,&B);
  if (A<=5) result=0;
  else if (A>=6&&A<=12) result = B/2;
  else result = B;
  printf ("%d",result);
  return 0;
}

Measured memory_bytes: 128
a[3];main(i,j,x){for(scanf("%d",&i);~scanf("%d%d%d",a,a+1,a+2);puts(a[0]*a[0]+a[1]*a[1]-a[2]*a[2]?"NO":"YES"))for(i=0;i<2;i++)for(j=i;j<3;j++)if(a[i]>a[j])x=a[i],a[i]=a[j],a[j]=x;exit(0);}

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

int main() {
	//freopen("input.txt", "r", stdin);
	int n, x, t;
	cin >> n >> x >> t;
	if(n%x == 0){
		cout << (n/x) * t << '\n';
		return 0;
	} else
		cout << ((n/x) + 1) * t << '\n';
	return 0;
}

Measured memory_bytes: 3628
/*やったぜ。　投稿者：変態糞土方 (8月16日（水）07時14分22秒)

昨日の8月15日にいつもの浮浪者のおっさん（60歳）と先日メールくれた汚れ好きの土方のにいちゃん

（45歳）とわし（53歳）の3人で県北にある川の土手の下で盛りあったぜ。

今日は明日が休みなんでコンビニで酒とつまみを買ってから滅多に人が来ない所なんで、

そこでしこたま酒を飲んでからやりはじめたんや。

3人でちんぽ舐めあいながら地下足袋だけになり持って来たいちぢく浣腸を3本ずつ入れあった。

しばらくしたら、けつの穴がひくひくして来るし、糞が出口を求めて腹の中でぐるぐるしている。

浮浪者のおっさんにけつの穴をなめさせながら、兄ちゃんのけつの穴を舐めてたら、

先に兄ちゃんがわしの口に糞をドバーっと出して来た。

それと同時におっさんもわしも糞を出したんや。もう顔中、糞まみれや、

3人で出した糞を手で掬いながらお互いの体にぬりあったり、

糞まみれのちんぽを舐めあって小便で浣腸したりした。ああ～～たまらねえぜ。

しばらくやりまくってから又浣腸をしあうともう気が狂う程気持ちええんじゃ。

浮浪者のおっさんのけつの穴にわしのちんぽを突うずるっ込んでやると

けつの穴が糞と小便でずるずるして気持ちが良い。

にいちゃんもおっさんの口にちんぽ突っ込んで腰をつかって居る。

糞まみれのおっさんのちんぽを掻きながら、思い切り射精したんや。

それからは、もうめちゃくちゃにおっさんと兄ちゃんの糞ちんぽを舐めあい、

糞を塗りあい、二回も男汁を出した。もう一度やりたいぜ。

やはり大勢で糞まみれになると最高やで。こんな、変態親父と糞あそびしないか。

ああ～～早く糞まみれになろうぜ。

岡山の県北であえる奴なら最高や。わしは163*90*53,おっさんは165*75*60、や

糞まみれでやりたいやつ、至急、メールくれや。

土方姿のまま浣腸して、糞だらけでやろうや。*/
#include "bits/stdc++.h"
#include <numeric>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define llMIN numeric_limits<long long>::min()
#define intMIN numeric_limits<int>::min()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double

ll gcd(ll a,ll b){//最大公約数
  if(a<b){
    swap(a,b);
  }
  if (a%b==0){
		return(b);
    }
	else{
		return(gcd(b,a%b));
    }
}
ll lcm(ll a, ll b)
{
  ll numgcd=gcd(a, b);
  ll num1=a/numgcd;
  ll num2=b/numgcd;
    return (num1*num2*numgcd);
}
int main(void){
  ll n;
  cin>>n;
  vector<string> s(n);
  vl t(n);
  rep(i,n){
    cin>>s[i]>>t[i];
  }
  string x;
  cin>>x;
  ll ans=0;
  int mode=0;
  rep(i,n){
    if(mode==0){
      if(s[i]==x){
        mode=1;
      }
    }else{
      ans+=t[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  
  if (A.back() == B[0] && B.back() == C[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int E, Y;
	int start = 0;
	int wareki = '?';
	if (scanf("%d%d", &E, &Y) != 2) return 1;
	if (E == 0) {
		if (Y <= 1911) { start = 1868; wareki = 'M'; }
		else if (Y <= 1925) { start = 1912; wareki = 'T'; }
		else if (Y <= 1988) { start = 1926; wareki = 'S'; }
		else { start = 1989; wareki = 'H'; }
		printf("%c%d\n", wareki, Y - start + 1);
	} else {
		switch (E) {
			case 1: start = 1868; break;
			case 2: start = 1912; break;
			case 3: start = 1926; break;
			case 4: start = 1989; break;
		}
		printf("%d\n", Y - 1 + start);
	}
	return 0;
}



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

using namespace std;

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

  int n; cin >> n;
  vector < int > a(n);

  for(int &x : a) cin >> x;
  sort(a.begin(), a.end());

  long long ans = a.back() - a.front();
  for(int i = 1; i < a.size() - 1; ++i) {
    if(a[i] < 0) ans -= a[i];
    else ans += a[i];
  }

  cout << ans << endl;

  for(int i = 1; i < a.size() - 1; ++i) {
    if(a[i] < 0) {
      cout << a.back() << " " << a[i] << endl;
      a.back() -= a[i];
    }
    else {
      cout << a.front() << " " << a[i] << endl;
      a.front() -= a[i];
    }
  }

  cout << a.back() << " " << a.front() << endl;

  return 0;
}

Measured memory_bytes: 2304
import java.util.*;
import java.math.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();

        if (A + K - 1 < B - K + 1) {
            for (int i = A; i <= A + K - 1; i++) {
                System.out.println(i);
            }

            for (int i = B - K + 1; i <= B; i++) {
                System.out.println(i);
            }
        } else {
            for (int i = A; i <= B; i++) {
                System.out.println(i);
            }
        }

        return;
    }

}

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

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define int int64_t

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

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

template<typename STL> inline void print_STL(STL c, string ab = ""){
	cout << ab << '\n';
	for(auto t : c) cout << t << ' '; cout << '\n';}

template<typename VEC> inline void import_VEC(VEC& c, int n){
	typename VEC::value_type tmp;
	for(int i = 0; i < n; ++i){	cin >> tmp; c.push_back(tmp);} }

#define SPRE(x) setprecision(x) // 精度を指定

template<class T>	using Matrix = vector<vector<T>>;

signed main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
	int k,s;
	cin >> k >> s;

	int count = 0;
	k++;
	REP(i,0,k)
		REP(j,0,k)
		{
			int tmp = s - i - j;
			if(tmp >=0)
			{
				if(tmp < k)
					count++;
				continue;
			}
			else
				break;
		}

	cout << count << '\n';
}



Measured memory_bytes: 256
def main():
    a, b, c, x = [int(input()) for i in range(4)]

    correct = 0
    for i in range(a + 1):
        for j in range(b + 1):
            for k in range(c + 1):
                if 500 * i + 100 * j + 50 * k == x:
                    correct += 1

    print(correct)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38896
/*input
10 10
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

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


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll s,w;
	cin>>s>>w;
	if(s<=w){
		cout<<"unsafe\n";
	}else cout<<"safe\n";
	return 0;
}




Measured memory_bytes: 3612
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class abc088_c {
public:
    void solve(istream& in, ostream& out) {
        constexpr int n = 3;
        int c[n][n];
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                in >> c[i][j];
            }
        }
        int a[3], b[3];
        for (a[0] = -1000; a[0] <= 1000; ++a[0]) {
            for (int i = 1; i < n; ++i) {
                a[i] = c[i][0] - c[0][0] + a[0];
            }
            for (int j = 0; j < n; ++j) {
                b[j] = c[0][j] - a[0];
            }
            bool ok = true;
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                    if (a[i] + b[j] != c[i][j]) {
                        ok = false;
                    }
                }
            }
            if (ok) {
                out << "Yes\n";
                return;
            }
        }
        out << "No\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	abc088_c solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256