akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for (int i=0,_n=(int)(n); i < _n; i++)
template<class T> bool chkmin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool chkmax(T &a, T b) { return a < b ? (a = b, true) : false; }

typedef long long ll;

const int MAX_N = 100000 + 10;
int X[MAX_N];
int W[MAX_N];
int ans[MAX_N];
int pos[MAX_N];

int main2() {
  int N, L, T;
  scanf("%d%d%d", &N, &L, &T);
  REP(i, N) scanf("%d%d", &X[i], &W[i]);

  ll q = 0;
  for (int i = 1; i < N; i++) {
    if (W[0] == 1) {
      if (W[i] == 2) {
        int p = (X[i] - X[0]);
        if (p <= 2 * T) {
          q++;
          q += (2 * T - p) / L;
        }
      }
    } else {
      if (W[i] == 1) {
        int p = (L - X[i] + X[0]);
        if (p <= 2 * T) {
          q--;
          q -= (2 * T - p) / L;
        }
      }
    }
  }
  q = ((q % N) + N) % N;

  REP(i, N) {
    int x = 0;
    if (W[i] == 1) {
      x = (X[i] + T) % L;
    } else {
      x = ((X[i] - T) % L + L) % L;
    }
    pos[i] = x;
  }
  int pos0 = pos[0];
  sort(pos, pos + N);
  int s = 0;
  REP(i, N) {
    if (pos[i] == pos0) {
      s = i;
      if (W[0] == 2) break; // T秒後の状態で同じ地点にいる場合、蟻 0 が時計回りに進んでいるなら交換し終わった後なのでもっとも後ろ、半時計周りなら最も前。
    }
  }
  REP(i, N) ans[(q+i)%N] = pos[(i+s)%N];
  REP(i, N) printf("%d\n", ans[i]);
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}

Measured memory_bytes: 2816
S = input()
N = int(S)

if N <= 9:
	print(N)
	exit(0)

ans=0
b = False
for i in range( len(S) ):
	if i==0:
		ans += int(S[i])
		continue
	
	j = int(S[i])
	#print(i, j, ans)
	
	if b:
		ans += 9
	else:
		if j==9:
			ans += j
		if j!=9:
			b = True
			ans -= 1
			ans += 9

print(ans)
	
	




Measured memory_bytes: 3064
import java.util.Calendar;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		Calendar xc = Calendar.getInstance();
        xc.set(Calendar.YEAR, 2018);
        xc.set(Calendar.MONTH, x - 1);
        Calendar yc = Calendar.getInstance();
        yc.set(Calendar.YEAR, 2018);
        yc.set(Calendar.MONTH, y - 1);
        if (xc.getActualMaximum(Calendar.DAY_OF_MONTH) == yc.getActualMaximum(Calendar.DAY_OF_MONTH))
        	System.out.println("Yes");
        else
        	System.out.println("No");
	}
}

Measured memory_bytes: 22224
import sys
def gcd(a, b):
    for i in range(1, a+1):
        if a % i == 0:
            t = a // i
            if b % t == 0:
                return t
for line in sys.stdin:
    a, b = sorted(map(int, line.split()))
    gcdab = gcd(a, b)
    print(gcdab, a // gcdab * b)

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

using namespace std;

const int NMAX = 1000 + 10;
int tiles[NMAX][NMAX];

int main() {
    for (int i = 0; i < NMAX; ++i) {
        for (int j = 0; j < NMAX; ++j) {
            tiles[i][j] = 0;
        }
    }

    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;

        //左上(a,b)と右下(c,d)は+1して，残り2頂点(a,d)と(c,b)は-1する
        tiles[a][b]++;
        tiles[c][d]++;
        tiles[a][d]--;
        tiles[c][b]--;
    }

    for (int i = 0; i < NMAX; ++i) {
        for (int j = 1; j < NMAX; ++j) {
            tiles[i][j] += tiles[i][j - 1];
        }
    }


    for (int j = 0; j < NMAX; ++j) {
        for (int i = 1; i < NMAX; ++i) {
            tiles[i][j] += tiles[i - 1][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < NMAX; ++i) {
        for (int j = 0; j < NMAX; ++j) {
            ans = max(ans, tiles[i][j]);
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7108
N,X,Y = (int(x) for x in input().split())
X -=1
Y-=1
dist = [[0]*N for _ in range(N)]
for i in range(N):
  for j in range(N):
    if i >= j :
      continue
    d1 = j - i
    d2 = abs(X-i)+abs(Y-j)+1
    dist[i][j] = min(d1,d2)

cnt = [0]*(N)
for i in range(N):
  for j in range(N):
    num = dist[i][j]
    if num >0:
      cnt[num] += 1
for i in range(N-1):
  print(cnt[i+1])

Measured memory_bytes: 79196
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <bitset>
#include <vector>

using namespace std;

int a, b;

void solve()
{
    int n;
    cin >> n;
    cin >> a >> b;
    if ((b - a) % 2 == 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
}

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


Measured memory_bytes: 256
/***************************************************
 * Problem Name : Iroha Loves Strings.cpp
 * Problem Link : https://atcoder.jp/contests/abc042/tasks/abc042_b
 * OJ           : atCoder
 * Verdict      : Trying
 * Date         : 2019-11-17
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    int n, l;
    cin >> n >> l;
    vector<string>vec(n);
    for(int i = 0; i<n; i++){
		cin >> vec[i];
	}
	sort(all(vec));
	for(int i = 0; i<n; i++)cout<<vec[i];
	nl;
    return 0;
}


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

int main(){

  int a,b;

  cin  >> a >> b;

  if(a<b){

  cout << "a < b"<< endl;

  }

  if(a>b){

    cout<<"a > b"<< endl;

  }

  if(a==b){

    cout<<"a == b"<< endl;

  }

  return 0;

}

Measured memory_bytes: 1156
void main()
{
    int[] tmp = readln.split.to!(int[]);
    int a = tmp[0], b = tmp[1];

    if (a + b == 15)
    {
        "+".writeln;
    }
    else if (a * b == 15)
    {
        "*".writeln;
    }
    else
    {
        "x".writeln;
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

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

    pair<int, int> a[m];

    for(int i = 0; i < m; i++){
        cin >> a[i].first >> a[i].second;
    }

    int cou = 0;

    for(int i = 1; i <= n; i++){
        cou = 0;
        for(int j = 0; j < m; j++){
            if(a[j].first == i || a[j].second == i){
                cou++;
            }
        }
        cout << cou << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,s,i,min=1000,max=3,sum=0,ave;
  while(1){
    scanf("%d",&n);
    if(n==0){
      break;
    }
    for(i=0;i<n;i++){
      scanf("%d",&s);
      if(s<min){
	min=s;
      } 
      if(s>max){
	max=s;
      }
      sum=sum+s;
    }
    sum=sum-max-min;
    ave=sum/(n-2);
    printf("%d\n",ave);
    sum=0;
    min=1000;
    max=3;
  }
  return 0;
}

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

using namespace std;

int n, a;
int div4, div2, odd;

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

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a;
        if(a % 2 == 1) odd++;
        else if(a % 4 == 0) div4++;
        else div2++;
    }
    if(div4 >= odd) {
        cout << "Yes";
    }
    else if(div2 == 0 && div4 + 1 == odd) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}


Measured memory_bytes: 256
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));

        int N = scanner.nextInt();

        String res = "No";
        if (N % 4 == 0) res = "Yes";
        else if (N % 7 == 0) res = "Yes";
        else {
            for (int i = 1; i <= N/7; i++) {
                if ((N - 7 * i) % 4 == 0) {
                    res = "Yes";
                    break;
                }
            }
        }

        bufferedWriter.write(res);

        bufferedWriter.close();
        scanner.close();
    }
}

Measured memory_bytes: 25044
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=1e5+10;
const int inf=1e9;
ll n,k;
ll gcd(ll a,ll b){
	return b==0?a:gcd(b,a%b);
}
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>k;
	if(n%k==0){
		puts("0");
		return 0;
	}
	cout<<min(n%k,abs((n%k)-k))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<int> a(3,0);
  for(int i=0;i<s.size();i++){
    a[s[i]-'a']++;
  }
  puts(max({a[0],a[1],a[2]})-min({a[0],a[1],a[2]})<=1?"YES":"NO");
  return 0;
}

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

using namespace std;
const int MOD = 1e9 + 7;

int _mul (int, int);
int _pow (int, int);
void make_sum (int&, int);

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

	int passed = 0, ans = 0;
	for (int i = 0; i < L.size(); i++)
		if (L[i] == '1') {
			make_sum (ans, _mul (_pow(2, passed), _pow(3, L.size() - i - 1)));
			passed++;
		}
	make_sum (ans, _pow(2, passed));
	cout << ans << endl;
}

int _mul (int a, int b) {
	return 1LL * a * b % MOD;
}

int _pow (int a, int b) {
	if (!b)
		return 1;
	int res = _pow (a, b >> 1);
	res = _mul (res, res);
	if (b & 1) 
		res = _mul(res, a);
	return res;
}

void make_sum (int &a, int b) {
	a += b;
	if (a >= MOD)
		a -= MOD;
}

// SamMHD :: Jun27-2019 :: Another Day with Shayan...

Measured memory_bytes: 512
N = int(input())
A = []
for i in range(N):
  h,p = list(map(int, input().split()))
  A.append([h+p,h,p])
  
A.sort()

# N人積んだ時の最小の高さH
dp = [-1 for i in range(N+1)]
dp[0] = 0

for i in range(N):
  _,h,p = A[i]
  for j in range(N, 0, -1):
    ## まだj-1人積んだことがない
    if dp[j-1] < 0:
      continue
    ## 高すぎてつめない
    if dp[j-1] > h:
      continue
    if dp[j] < 0:
      dp[j] = dp[j-1] + p
    else:
      dp[j] = min(dp[j], dp[j-1] + p)
    
for i in range(N+1):
  if dp[i] < 0:
    print(i-1)
    exit(0)

print(N)


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

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

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	while (cin >> s && s != "#") {
		int64 y, m, d;
		cin >> y >> m >> d;
		if (y > 31 || (y == 31 && m >= 5)) {
			printf("? %d %d %d\n", y-30, m, d);
		} else {
			printf("HEISEI %d %d %d\n", y, m, d);
		}
	}
}



Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,k,t;
    cin>>n>>k>>t;
    
    long long ans;
    if(n%k==0)
    ans=(n/k)*t;
    else
        ans=(n/k+1)*t;
    cout<<ans<<endl;
        
}

Measured memory_bytes: 3628
s = int(input())

def f(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3 * n + 1
a_s = [s]
A = set([s])
for m in range(1, 1000000):
    a_m = f(a_s[-1])
    if a_m in A:
        ans = m + 1
        break

    a_s.append(a_m)
    A.add(a_m)

print(ans)


Measured memory_bytes: 3060
#include<stdio.h>

#define M   1000
#define D    500
#define C    100
#define L     50
#define X     10
#define V      5
#define I      1

int main(void)
{
        char ara[102];
        int sum = 0;
        int i = 0,j = 0;
        int num[102];

        for(i = 0; i < 102; i++)
        {
                ara[i]='0';
                num[i] = 0;
        }
        while( scanf("%s",ara) != EOF)
        {
                for(i = 0; i < 102; i++)
                {
                        if(ara[i] == '0')
                        {
                                j = i;
                                break;
                        }
                        if(ara[i] == 'I' )
                        {
                                num[i] = I;
                        }
                        else if(ara[i] == 'V' )
                        {
                                num[i] = V;
                        }
                        else if(ara[i] == 'X' )
                        {
                                num[i] = X;
                        }
                        else if(ara[i] == 'L' )
                        {
                                num[i] = L;
                        }
                        else if(ara[i] == 'C' )
                        {
                                num[i] = C;
                        }
                        else if(ara[i] == 'D' )
                        {
                                num[i] = D;
                        }
                        else if(ara[i] == 'M' )
                        {
                                num[i] = M;
                        }
                }
                for(i = 0;i < j; i ++)
                {
                        if(num[i] < num[i+1])
                        {
                          num[i] = -num[i];
                        }
                        sum += num[i];
                }
                printf("%d\n",sum);
                sum = 0;
                j = 0;
                for(i = 0; i < 102; i++)
                {
                        ara[i]='0';
                        num[i] = 0;
                }
        }
        return 0;
}

Measured memory_bytes: 540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int h, w, s;
int U[35][35];
int allsum = 0;
int sum[35][35];
// dp[y1][x1][y2][x2] := ??????(y1, x1), ??????(y2, x2)???????????¢??????????????????, 
// ??°?????????????????????????????§??°, ?????§????????????
pair<int, int> dp[35][35][35][35];

void sum2D(int h, int w) {
	rep(y, h + 1)rep(x, w + 1) sum[y][x] = 0;
	rep(y, h)rep(x, w) sum[y + 1][x + 1] = U[y][x]; // ?????????????????????
	rep(y, h + 1)rep(x, w) sum[y][x + 1] += sum[y][x]; // ?¨?
	rep(y, h)rep(x, w + 1) sum[y + 1][x] += sum[y][x]; // ???
}
int calcSum(int y1, int x1, int y2, int x2) {
	return sum[y2 + 1][x2 + 1] - sum[y2 + 1][x1] - sum[y1][x2 + 1] + sum[y1][x1];
}

pair<int, int> dfs(int y1, int x1, int y2, int x2) {
	if(dp[y1][x1][y2][x2] != make_pair(0, INF)) return dp[y1][x1][y2][x2];
	
	auto ret = make_pair(1, s - (allsum - calcSum(y1, x1, y2, x2)));

	for (int i = x1; i < x2; ++i){
		if(s - (allsum - calcSum(y1, x1, y2, i)) < 0) continue;
		if(s - (allsum - calcSum(y1, i + 1, y2, x2)) < 0) continue;
		auto ret1 = dfs(y1, x1, y2, i);
		auto ret2 = dfs(y1, i + 1, y2, x2);
		chmax(ret, make_pair(ret1.fi + ret2.fi, min(ret1.se, ret2.se)));
	}

	for (int i = y1; i < y2; ++i){
		if(s - (allsum - calcSum(y1, x1, i, x2)) < 0) continue;
		if(s - (allsum - calcSum(i + 1, x1, y2, x2)) < 0) continue;
		auto ret1 = dfs(y1, x1, i, x2);
		auto ret2 = dfs(i + 1, x1, y2, x2);
		chmax(ret, make_pair(ret1.fi + ret2.fi, min(ret1.se, ret2.se)));
	}
	return dp[y1][x1][y2][x2] = ret;
}

int main(void) {
	while(1) {
		scanf("%d %d %d", &h, &w, &s);

		if(h == 0 && w == 0 && s == 0) break;
		rep(i, h)rep(j, w) scanf("%d", &U[i][j]);
		allsum = 0;
		rep(i, h)rep(j, w) allsum += U[i][j];
		sum2D(h, w);
		rep(i, 35)rep(j, 35)rep(k, 35)rep(l, 35) dp[i][j][k][l] = make_pair(0, INF);
		auto ans = dfs(0, 0, h - 1, w - 1);
		printf("%d %d\n", ans.fi, ans.se);
	}
	return 0;
}

Measured memory_bytes: 14952
#include "bits/stdc++.h"
using namespace std;

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define REVREP(i, n)      for(ll i = n - 1; i >= 0 ; i--)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }

void Solve()
{
	ll N, K;
	cin >> N >> K;
	VL A(N);
	REP(i, N) cin >> A[i];

	vector<string> ans(N - K);
	REPN(i, K, N) {
		ans[i - K] = A[i - K] < A[i] ? "Yes" : "No";
	}

	for (auto one : ans) {
		cout << one << endl;
	}
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


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

const W INF = 1LL << 50;

struct edge{
	int to;
	W cost;
};
typedef vector<vector <edge > > Graph;

vector<W> dijkstra(int s, const Graph& G){
	typedef pair<W, int> P;
	vector<W> d(G.size(), INF);
	d[s] = 0;
	priority_queue< P, vector<P>, greater<P> > que;
	que.push(P(0, s));
	while(!que.empty()){
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
	return d;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N, M, s, t;
	cin >> N >> M >> s >> t;
	s--, t--;

	Graph G(N);
	for(int i = 0; i < M; i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--, b--, c--;
		G[a].push_back({ b, d });
		G[b].push_back({ a, d });
		G[a].push_back({ c, d });
		G[c].push_back({ a, d });
		G[b].push_back({ c, d });
		G[c].push_back({ b, d });
	}

	auto res = dijkstra(s, G);
	cout << res[t] << endl;
}



Measured memory_bytes: 23784
L, R = map(int, input().split())

m = 2020
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if j % 2019 == 0:
            print(0)
            exit()
        else:
            tmp = (i % 2019) * (j % 2019) % 2019
            if tmp < m:
                m = tmp
print(m)

Measured memory_bytes: 40684
#include <iostream>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int a[1000][1000]={},b[1000]={},c[1000]={};
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
   for(int i=1;i<=m;i++){
            cin>>b[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            c[i]=c[i]+a[i][j]*b[j];
        }
    }
    for(int i=1;i<=n;i++){
        cout<<c[i]<<endl;
    }
    return 0;
}


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

int n;
vector<int> v;

int main(void) {
    ios_base::sync_with_stdio(0);   cin.tie(0);
    cin >> n;
    v.resize(1 << n);
    for(int i = 0; i < (1 << n); ++i)   cin >> v[i];
    sort(v.begin(), v.end());
    multiset<int> t;    t.insert(v.back());
    v.pop_back();
    multiset<int> s(v.begin(), v.end());

    for(int i = 0; i < n; ++i) {
        vector<int> tmp;
        for(auto j : t) {
            auto it = s.lower_bound(j);
            if(it == s.begin()) {
                cout << "No";
                return 0;
            }
            tmp.push_back(*prev(it));
            s.erase(prev(it));
        }
        for(auto j : tmp)   t.insert(j);
    }
    cout << "Yes";
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int vi[n];
    int ci[n];
    for(int i=0;i<n;++i)
        cin >> vi[i];
    for(int i=0;i<n;++i)
        cin >> ci[i];

    int sum = 0;
    for(int i=0;i<n;++i)
    {
        if(vi[i]>ci[i])
            sum += vi[i] - ci[i];
    }

    cout << sum << endl;
    return 0;
}

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

template<typename T>
struct Imos2D {
	vector<vector<T>> board;
	const int h, w;
	Imos2D(int h, int w) : 
		board(vector<vector<T>>(h + 2, vector<T>(w + 2, 0))),
		w(w + 2),
		h(h + 2)
		{}
	// 範囲外許さないマン
	bool able(int y, int x) {
		if(y <= 0 or h < y) return false;
		if(x <= 0 or w < x) return false;
		return true;
	}
	bool able(int y1, int x1, int y2, int x2) {
		if(not able(y1, x1)) return false;
		if(not able(y2, x2)) return false;
		if(make_pair(y1, x1) > make_pair(y2, x2)) return false;
		return true;
	}
	// 1点加算
	void add(int y, int x, T z) {
		assert(able(y, x));
		board[y][x] += z;
	}
	// 矩形加算
	void add(int y1, int x1, int y2, int x2, T z) {
		assert(able(y1, x1, y2, x2));
		board[y1][x1] += z;
		board[y1][x2 + 1] -= z;
		board[y2 + 1][x1] -= z;
		board[y2 + 1][x2 + 1] += z;
	}
	// 累積和
	void build() {
		for(int y = 1; y < h; ++y) {
			for(int x = 1; x < w; ++x) {
				board[y][x] += board[y][x - 1];
			}
		}
		for(int y = 1; y < h; ++y) {
			for(int x = 1; x < w; ++x) {
				board[y][x] += board[y - 1][x];
			}
		}
	}
	// 1点取得
	T get(int y, int x) {
		assert(able(y, x));
		return board[y][x];
	}
	// 矩形取得
	T get(int y1, int x1, int y2, int x2) {
		assert(able(y1, x1, y2, x2));
		return board[y2][x2] - board[y2][x1 - 1] - board[y1 - 1][x2]+board[y1 - 1][x1 - 1];
	}
	void debug() {
		for(int y = 1; y < h - 1; ++y) {
			for(int x = 1; x < w - 1; ++x) {
				cout << board[y][x] << " ";
			}
			cout << '\n';
		}
	}
};

int main() {
	int n, k; cin >> n >> k;
	int x[n], y[n];
	for(int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
		char c; cin >> c;
		if(c == 'W') {
			y[i] += k;
		}
		x[i] %= 2 * k;
		y[i] %= 2 * k;
	}
	Imos2D<int> imos(2 * k, 2 * k);
	for(int i = 0; i < n; ++i) {
		imos.add(y[i] + 1, x[i] + 1, 1);
	}
	imos.build();
	int ans = 0;
	for(int y = 1; y <= k; ++y) {
		for(int x = 1; x <= k; ++x) {
			int cnt = 0;
			cnt += imos.get(y, x, y + k - 1, x + k - 1);
			int ny = y + k, nx = x + k;
			cnt += imos.get(ny, nx, 2 * k, 2 * k);
			if(ny > k + 1) {
				cnt += imos.get(1, nx, y - 1, 2 * k);
			}
			if(nx > k + 1) {
				cnt += imos.get(ny, 1, 2 * k, x - 1);
			}
			if(ny > k + 1 and nx > k + 1) {
				cnt += imos.get(1, 1, y - 1, x - 1);
			}
			ans = max(ans, max(cnt, n - cnt));
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 16768
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 1e2 + 10;
// make sure N size is correctttt!!!!!!!!!
const int K = 1e5 + 10;

int n, k, a[N];
int dp[N][K];

int get(int idx, int r, int l){
   int ans = dp[idx][r];
   if(l-1 >= 0)
      ans -= dp[idx][l-1];
   ans += mod;
   ans %= mod;
   return ans;
}

int32_t main(){_

   cin>>n>>k;

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

   //dp[i][j] => prefix sum of no of ways to get sum j from first i person keeping in mind the given bound on each person

   dp[1][0] = 1;
   for (int i = 1; i <= a[1]; ++i)
      dp[1][i] = (1 + dp[1][i-1])%mod;

   for (int i = a[1]+1; i <= k; ++i)
   {
      dp[1][i] += dp[1][i-1];
      dp[1][i] %= mod;
   }

   for (int i = 2; i <= n; ++i)
   {
      for (int j = 0; j <= k; ++j)
      {
         int thisPerson = min(a[i], j);
         int rest = j - thisPerson;
         dp[i][j] = get(i-1, j, rest);
      }
      for (int j = 1; j <= k; ++j)
      {
         (dp[i][j] += dp[i][j-1]) %= mod;
      }
   }

   cout<<get(n, k, k);

   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

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

  int ans = INF;
  for(int i = 0; i < 1 << n; i++){
    vector<int> v(m, 0);
    int cost = 0;
    for(int j = 0; j < n; j++){
      if(i >> j & 1){
        for(int k = 0; k < m; k++){
          v[k] += a[j][k];
        }
        cost += c[j];
      }
    }
    bool judge = true;
    for(int j = 0; j < m; j++){
      if(v[j] < x) judge = false;
    }
    if(judge) ans = min(ans, cost);
  }
  if(ans == INF) ans = -1;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

bool match(vector<string> A, int i, int j, vector<string> B) {
	int N = A.size();
	int M = B.size();
	FOR(p, 0, M) {
		FOR(q, 0, M) {
			if (B[p][q] != A[i + p][j + q]) return false;
		}
	}
	return true;
}

int main_() {
	int W, a, b;
	cin >> W >> a >> b;

	int ans = 0;
	if (b + W < a) ans = a - (b + W);
	else if (a + W < b) ans = b - (a + W);

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char a[10005];
int main()
{
    int n,k,y,x,a;
    cin>>n>>k>>x>>y;
    if(n<=k)
    {
        a=n*x;
    }
    else if(n>k)
    {
        a=(n-k)*y+x*k;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    D = NLI()
    
    if D[0] != 0:
        print(0)
        sys.exit()
    else:
        Dc = sorted(collections.Counter(D).items())
        
        if Dc[0] != (0,1):
            print(0)
            sys.exit()
        elif Dc[1][0] != 1:
            print(0)
            sys.exit()
        else:
            ans = 1
            for i in range(2,len(Dc)):
                if Dc[i][0] != i:
                    print(0)
                    sys.exit()
                else:
                    ans = (ans * ((Dc[i-1][1] **Dc[i][1]))%MOD2)%MOD2
            print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 25764
#include <iostream>
using namespace std;
int main() {
	int N;
	int flg = 0;
	cin >> N;
	for (int i = 0;i < 30&&flg==0;i++) {
		for (int j = 0;j < 20&&flg==0;j++) {
			if (i * 4 + j * 7 == N) {
				flg = 1;
			}
		}
	}
	if (flg == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

string s[51], t[51];

signed main(){
    int n, m;
    cin >> n >> m;
    rep(i, 0, n) cin >> s[i];
    rep(i, 0, m) cin >> t[i];
    rep(i, 0, n){
        rep(j, 0, n){
            bool g = true;
            rep(k, 0, m){
                rep(l, 0, m){
                    if(s[i + k][j + l] != t[k][l]){
                        g = false;
                        l = m; k = m;
                    }
                }
            }
            if(g){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 1e9  //
#define INFLL 4e18  //
#define MOD (1e9)+7
#define MP make_pair

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

// a 0x61  z 0x7a  0 0x30

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

    ll n = (ll) log10(k) + 1; //桁数
    ll q = k / (ll) pow(10, n - 1); //最高位の数字

    ll sum;

    if (k == (q + 1) * (ll) pow(10, n - 1) - 1) {
        sum = q + (n - 1)*9;
    } else {
        sum = q - 1 + (n - 1)*9;
    }

    cout << sum << endl;

    return 0;
}

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

#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>
#include <sstream>

using namespace std;

class apc001_a {
public:
    void solve(istream& in, ostream& out) {
        int X, Y;
        in >> X >> Y;
        out << (X % Y ? X : -1) << "\n";
    }
};


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


Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

string s;

int main(){
  cin >> s;
  cout << s.substr(0,4) + " " + s.substr(4) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

#define fr first
#define sc second

using namespace std;

typedef pair<const char*,int> parsed;

const int retmns[]     = {2,1,0};
const int retmul3[][3] = {{0,0,0},{0,1,1},{0,1,2}}; 
const int retadd3[][3] = {{0,1,2},{1,1,2},{2,2,2}};

parsed fomula(parsed p){
  if(isdigit(*(p.fr))){
    return parsed(p.fr+1, *(p.fr)-'0');
  }
  if(*(p.fr) == '('){
    parsed a = fomula(make_pair(p.fr+1,0));
    parsed b = fomula(make_pair(a.fr+1,0));
    if( *(a.fr) == '*' ) return parsed( b.fr+1, retmul3[a.sc][b.sc] );
    else return parsed(b.fr+1, retadd3[a.sc][b.sc]);
  }
  if(*(p.fr) == '-'){
    parsed a = fomula(make_pair(p.fr+1,0));
    return parsed(a.fr, retmns[a.sc] );
  }
}

int main(){
  while(true){
    int ans = 0;
    string s;
    cin >> s;
    if(s==".")break;
    for(int p = 0; p < 3; ++p){
      for(int q = 0; q < 3; ++q){
	for(int r = 0; r < 3; ++r){
	  string t=s;
	  for(int l = 0; l < t.length(); ++l){
	    if(t[l]=='P')t[l]='0'+p;
	    if(t[l]=='Q')t[l]='0'+q;
	    if(t[l]=='R')t[l]='0'+r;
	  }
	  int ret = fomula( parsed(t.c_str(),0) ).sc;
	  //cout << "EXPRESSION : " <<  t << " = " << ret << endl;
	  if( ret == 2 ) ++ans;
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
A,B,C = map(int,input().split())
K = int(input())
for k in range(K):
    if A < B < C:
        break
    elif A >= B:
        B = B*2
    elif B >= C:
        C = C*2
if A < B < C:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main()
{
	///////////input/////////////

	int N, M, C;
	cin >> N >> M >> C;

	int A[30][30];
	int B[30];

	for (int i = 0; i < M; ++i) cin >> B[i];

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < M; ++j)
		{
			cin >> A[i][j];
		}
	}

	/////////////compute////////////

	int ans = 0;

	for (int i = 0; i < N; ++i)
	{
		int sum = 0;

		for (int j = 0; j < M; ++j)
		{
			sum += A[i][j] * B[j];
		}

		if (sum + C > 0) ++ans;
	}

	cout << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char a[100000]={'0'};
    int i;
    while(~scanf("%s",a))
    {
        for(i=0;i<1000000;i++)
        {
            if(a[i]=='\0')
            {
                printf("\n");
                break;
            }
            if(i%2==0)
            {
                printf("%c",a[i]);
            }
        }
    }
}


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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int next=1,ans=0;
    for(int i=0;i<n;i++){
        if(next==a[i]){
            next++;
        }else{
            ans++;
        }
    }
    if(ans==n)ans=-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
from itertools import product
n=int(input())
cnt=0
kazu=[3,5,7]
for j in range(3,10):
    kumiawase = list(product(kazu, repeat=j))
    for kumi in kumiawase:
        suuji=''
        for moji in kumi:
            suuji+=str(moji)
        if '3'  not in suuji:
            continue
        if '5'  not in suuji:
            continue
        if '7'  not in suuji:
            continue
        hantei=int(suuji)
        if hantei <=n:
            cnt+=1
print(cnt)

Measured memory_bytes: 6756
IDENTIFICATION DIVISION.
      PROGRAM-ID. 103A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(100).
      01 A-TBL.
      	03 AX PIC 9(3) OCCURS 3 TIMES.
      01 IDX PIC 9(1).
      01 ANS PIC ZZ9.
      
      PROCEDURE DIVISION.
      ACCEPT INP.
	  UNSTRING INP DELIMITED BY " "
      INTO AX(1) AX(2) AX(3).
      
      SORT AX DESCENDING KEY AX.

      COMPUTE ANS = ( AX(1) - AX(2) ) + ( AX(2) - AX(3) )
      
      DISPLAY FUNCTION TRIM(ANS).
      
      STOP RUN.

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

int main(void) {
  int N;
  cin >> N;
  vector<double> x(N);
  vector<string> u(N);
  double sum = 0.0;
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> u[i];
    if (u[i] == "JPY") sum += x[i];
    else sum += x[i] * 380000;
  }
  cout << fixed << setprecision(10) << sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int k, s;
    cin >> k >> s;
    int ans = 0;
    REP(a, k+1){
        REP(b, k+1){
            int c = s - a - b;
            if(c >= 0 && c <= k){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
int n;
ll a[200010];
ll sum[200010];
void add(){
  sum[0]=0;
  rep1(i,n){
    sum[i]=sum[i-1]+a[i-1];
  }
}
ll solve(){
  ll res=0,x=0;
  int l=0,r=0;
  while(l<n){
    if(sum[r+1]-sum[l]==(x^a[r])&&r+1<=n){
      x=x^a[r];
      r++;
    }
    else{
      res+=r-l;
      x-=a[l];
      l++;
    }
  }
  return res;
}
int main(){
  cin>>n;
  rep(i,n) cin>>a[i];
  add();
  prin(solve());
  return 0;
}


Measured memory_bytes: 3328
A, B, C, D = list(map(int, input().split()))

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)


sais = lcm(C, D)

buff_a = A - 1


sais_mx = B // sais
sais_mm = buff_a // sais
sais_count = sais_mx - sais_mm
if sais_mx > 0:
    sais_count = sais_mx - sais_mm
else:
    sais_count = 0

# print('sais_mx ' + str(sais_mx))
# print('sais_count ' + str(sais_count))

c_mx = B // C
c_mm = buff_a // C
c_count = c_mx - c_mm

d_mx = B // D
d_mm = buff_a // D
d_count = d_mx - d_mm

# print("c d")
# print(c_count, d_count)
zentai = c_count + d_count

# zentai = zentai - (sais_count*2)
zentai = zentai - (sais_count)

b_a = B - A
ans = b_a - zentai
# print(zentai)
print(ans+1)


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

int main() {
	char s1[3], s2[3];
	int i, c = 0;

	scanf("%s %s", s1, s2);

	for (i = 0; i < 3; i++) {
		if (s1[i] == s2[i]) {
			c++;
		}
	}
	printf("%d", c);
	return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> vec(n,-1);
  
  //無理やり作った変数
  int ans = 0;
  
  int s,c;
  rep(i, m){
    cin >> s >> c;
    //何も条件が与えられていないものには代入
    if(vec[s-1]==-1)
      vec[s-1] = c;
    //すでに代入されていてそれが違う数の時
    else if(vec[s-1]!=c)
      ans = 1;
  }
  
  //最後に数値が-1になっているものを0にする
  if(vec[0]==-1){
    if(n>1)
      vec[0]=1;
    else
      vec[0]=0;
  }
  for(int i=1; i<n; i++){
    if (vec[i] == -1)
      vec[i] = 0;
  }
  
  //表示
  if (n==1){
    if(ans==1)
      cout << -1 << endl;
    else
      cout << vec[0] << endl;
  }
  else if (n>1){
    if(vec[0]==0 || ans==1)
      cout << -1 << endl;
    else{
      rep(i, n){
        cout << vec[i];
      }
      cout << endl;
    }
  }
  else cout << vec[0] << endl;   
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int x,y,z;
    cin >> x >> y >> z;
    int tmp = x;
    x = y;
    y = tmp;
    tmp = x;
    x = z;
    z = tmp;
    printf("%d %d %d\n", x,y,z);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 2010
int n,m,ans,a[N][N],b[N][N],q[N],L[N],R[N];
char str[N][N];
int main(){
	scanf("%d%d",&n,&m);
	ans=max(n,m);
	for(int i=1;i<=n;++i){
		scanf("%s",str[i]+1);
		for(int j=1;j<=m;++j) a[i][j]=str[i][j]=='#';
	}
	for(int i=1;i<=m-1;++i) b[n][i]=1;
	for(int i=1;i<n;++i){
		for(int j=1;j<m;++j){
			if((a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1])%2==0) b[i][j]=b[i-1][j]+1;
			else b[i][j]=0;
		}
	}
	for(int i=1;i<=n;++i){
		int top=1;q[top]=0;
		for(int j=1;j<m;++j){
			while(top && b[i-1][q[top]]>=b[i-1][j]) --top;
			L[j]=q[top];q[++top]=j;
		}
		top=1;q[top]=m;
		for(int j=m-1;j>=1;--j){
			while(top && b[i-1][q[top]]>=b[i-1][j]) --top;
			R[j]=q[top];q[++top]=j;
		}
		for(int j=1;j<m;++j) ans=max(ans,(b[i-1][j]+1)*(R[j]-L[j]));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 35712
#include <cstdio>
#include <cmath>
const int MAX = 21;
typedef double D;

D dis(D x1,D y1,D x2,D y2){
  D d;
  d = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
  return d;
}

int main(){
  D x[MAX],y[MAX];
  int t = 0;
  D S = 0.0,z,a,b,c;

  while(true){
    if(scanf("%lf,%lf",&x[t] ,&y[t]) == EOF) break;
    t++;
  }

  for(int i = 2 ; i < t ; i++){
    a = dis(x[0],y[0],x[i-1],y[i-1]);
    b = dis(x[0],y[0],x[i],y[i]);
    c = dis(x[i-1],y[i-1],x[i],y[i]);
    z = (a + b + c) / 2;

    S += sqrt(z*(z-a)*(z-b)*(z-c));
  }
 
  printf("%.6f\n",S);

  return 0;
}

Measured memory_bytes: 1084
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
char ss[55],t[55],shuchu[55],cmp[55];
int lenss,lent;
bool kobe=0,ok=0;
int comp(char *a,char *b)
{
	for(int i=1;i<=lenss;i++)
	{
		if(a[i]==b[i])continue;
		if(a[i]>b[i])return 1;
		if(a[i]<b[i])return -1;
	}
	return 0;
}
void update(char *s)
{
	for(int i=1;i<=lenss;i++)
	{
		if(s[i]=='?')s[i]='a';
	}
	return;
}
int main()
{
	cin>>ss+1;lenss=strlen(ss+1);cin>>t+1;lent=strlen(t+1);for(int i=1;i<=lenss;i++)shuchu[i]='z';
//	for(int i=1;i<=lenss;i++)cout<<shuchu[i];
	for(int i=1;i<=lenss-lent+1;i++)
	{
		for(int k=1;k<=lenss;k++)cmp[k]=ss[k];kobe=1;
		for(int j=1;j<=lent;j++)
		{
			if(ss[i+j-1]=='?'||ss[i+j-1]==t[j]){
				cmp[i+j-1]=t[j];continue;
			}
			if(ss[i+j-1]!=t[j]){
				kobe=0;break;
			}
		}
		if(kobe==1)
		{
			ok=1;
			if(comp(shuchu,cmp)==1){
				for(int z=1;z<=lenss;z++)
				{
					shuchu[z]=cmp[z];
				}
			}
		}
	}
	if(ok==0)puts("UNRESTORABLE");
	else {
		update(shuchu);puts(shuchu+1);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define MOD 1000000007
#define mod 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2*1e9

int main()
{
    fastio;
    int n;
    cin >> n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin >> v[i];
    vector<int>dp(n);
    dp[n-1]=0;
    dp[n-2]=abs(v[n-2]-v[n-1]);
    for(int i=n-3;i>-1;i--)
    {
        dp[i]=min(dp[i+1]+abs(v[i+1]-v[i]),dp[i+2]+abs(v[i+2]-v[i]));
    }
    cout << dp[0] << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] ans = new int[n + 1];
		long res = 0L;
		for(int i = 3; i <= n; i += 3) ans[i] = 1;
		for(int i = 5; i <= n; i += 5) ans[i] = 1;
		for(int i = 1; i <= n; i++) {
			if(ans[i] == 0) res += i;
		}
		System.out.println(res);
	}
} 


Measured memory_bytes: 39492