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

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const int MAXN = 310;
const int MOD = 1000000007;

using std::vector;
using std::pair;
using std::make_pair;

int f[MAXN][MAXN][MAXN];
vector<pair<int, int> >lim[MAXN];

int main()
{
	int n, m;
	in(n); in(m);

	FOR(i, 1, m) {
		int l, r, x;
		in(l); in(r); in(x);
		lim[r].push_back(make_pair(l, x));
	}
	
	f[1][0][0] = 3;

	FOR(i, 0, lim[1].size() - 1) if (lim[1][i].second != 1) {puts("0"); return 0;}
	
	FOR(i, 1, n - 1) {
		int miL = 0, miR = i, mxL = 0, mxR = i;
		FOR(j, 0, lim[i + 1].size() - 1) {
			if (lim[i + 1][j].second == 1) chkmin(mxR, lim[i + 1][j].first - 1);
			else if (lim[i + 1][j].second == 2)	{
				chkmax(mxL, lim[i + 1][j].first);
				chkmin(miR, lim[i + 1][j].first - 1);
			}
			else if (lim[i + 1][j].second == 3) chkmax(miL, lim[i + 1][j].first);
		}
		if (miL > miR || mxL > mxR) {puts("0"); return 0;}
		FOR(j, 0, i - 1) FOR(k, j, i - 1) {
			if ((j == k && j) || !f[i][j][k]) continue;
			if (miL <= j && j <= miR && mxL <= k && k <= mxR)
				f[i + 1][j][k] = (f[i + 1][j][k] + f[i][j][k]) % MOD;
			if (miL <= k && k <= miR && mxL <= i && i <= mxR)
				f[i + 1][k][i] = (f[i + 1][k][i] + f[i][j][k]) % MOD;
			if (miL <= j && j <= miR && mxL <= i && i <= mxR)
				f[i + 1][j][i] = (f[i + 1][j][i] + f[i][j][k]) % MOD;
		}
	}

	int ans = 0;
	FOR(i, 0, n - 1) FOR(j, i, n - 1) ans = (ans + f[n][i][j]) % MOD;

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


Measured memory_bytes: 112896
#include<bits/stdc++.h>
using namespace std;
int h,w,k,visx[10],visy[10],num[10][10],cnt=0,tmp,ans=0;
string s;
void search(int pos) {
	if(pos>h+w) {
		tmp=cnt;
		for(int i=1;i<=h;++i)
			for(int j=1;j<=w;++j)
				if((visx[i]||visy[j])&&num[i][j])
					tmp--;
		if(tmp==k) {
			ans++;
//			for(int i=1;i<=h;++i)
//				if(visx[i])
//					printf("%d ",i);
//			printf("\n");
//			for(int i=1;i<=w;++i)
//				if(visy[i])
//					printf("%d ",i);
//			printf("\n");
		}
		return;
	}
	search(pos+1);
	if(pos<=h) {
		visx[pos]=1;
		search(pos+1);
		visx[pos]=0;
	} else {
		visy[pos-h]=1;
		search(pos+1);
		visy[pos-h]=0;
	}
}
int main()
{
	scanf("%d%d%d",&h,&w,&k);
	for(int i=1;i<=h;++i) {
		cin>>s;
		for(int j=0;j<w;++j)
			if(s[j]=='#')
				num[i][j+1]=1,cnt++;
	}
	search(1);
	printf("%d",ans);
	return 0;
}

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

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        while (n-- > 0) {
            String s1 = input.next();
            String s2 = input.next();
            System.out.println(getLcs(s1, s2));
        }
    }
    
    int getLcs(String s1, String s2) {
        char[] cs1 = s1.toCharArray();
        char[] cs2 = s2.toCharArray();
        int[][] lcs = new int[cs1.length+1][cs2.length+1];
        
        for (int i = 0; i < cs1.length; i++) {
            for (int j = 0; j < cs2.length; j++) {
                if (cs1[i] == cs2[j]) {
                    lcs[i+1][j+1] = Math.max(Math.max(lcs[i][j]+1, lcs[i][j+1]), lcs[i+1][j]);
                } else {
                    lcs[i+1][j+1] = Math.max(Math.max(lcs[i][j], lcs[i][j+1]), lcs[i+1][j]);
                }
            }
        }
        return lcs[cs1.length][cs2.length];
    }
    
    void swap(int[] A, int x, int y) {
        int temp = A[x];
        A[x] = A[y];
        A[y] = temp;
    }
    
}

class Scanner {
    BufferedReader r;
    StreamTokenizer st;
    
    public Scanner(InputStream in) {
        r = new BufferedReader(new InputStreamReader(in));
        st = new StreamTokenizer(r);
    }
    
    public String next() {
        nextToken();
        return st.sval;
    }
    
    public Integer nextInt() {
        nextToken();
        return (int)st.nval;
    }
    
    private int nextToken() {
        int token = st.TT_EOF;
        try {
            token = st.nextToken();
        } catch (IOException e) {
        }
        return token;
    }
}

Measured memory_bytes: 60496
#include <stdio.h>
int main(void) {
    int k, s, count = 0;
    scanf("%d%d", &k, &s);
    for(int x = 0; x <= k; x++) {
        for(int y = 0; y <= k; y++) {
            int z = s - x - y;
            if(z >= 0 && z <= k) count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
int main(void)
{
	ll n;
	string s;
	cin>>n;
	cin>>s;
	if(n>=3200)
	{
		cout<<s;
	}
	else
	{
		cout<<"red";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    ll h, w;
    cin >> h >> w;
    char c;
    ll res = 0;
    REP(i, h){
        REP(j, w){
            cin >> c;
            if(c == '#') res++;
        }
    }
    if(res == h + w - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
typedef long long ll;
 
using namespace std;
 
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.in","w",stdout);
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll i,j,k,n;
    cin>>n;
    vector<ll> v(n);
    ll m(0),ans(0);
    for(i=0;i<n;i++){
    	cin>>v[i];
    	m=max(v[i],m);
    	if(i){
    		ans+=m-v[i];
    	}
    }
    cout<<ans;
 
	
	
	
 
 
 
 
 
 
 
	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

typedef pair<ll, ll> p_ll;

int main() {
  int N; cin >> N;
  p_ll ord[N];
  rep(i,N) {
    int a; cin >> a; a--;
    ord[i] = make_pair(i,a);
  }
  sort(ord, ord+N, [](const p_ll &x, const p_ll &y){return x.second<y.second;});

  ll result = 0;
  set<ll> pos; pos.insert(-1); pos.insert(N);
  rep(i,N) {
    ll of = ord[i].first, os = ord[i].second;
    auto r = pos.upper_bound(of);
    auto l = r; l--;
    // cout << os << ": " << *l << " " << of << " " << *r << endl;
    result += (of-*l) * (*r-of) * (os+1);
    pos.insert(of);
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll ans;
  string s,t;
  cin >> t;
  ans=0;
  s="CODEFESTIVAL2016";
  rep(i,16)if(s[i]!=t[i])ans++;
  printf("%lld",ans);
}

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

int main()
{
  int64_t N, a;
  cin >> N;
  vector<vector<int64_t>> A(N, vector<int64_t>(N - 1));
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N - 1; j++)
    {
      cin >> A.at(i).at(j);
      A.at(i).at(j)--;
    }
    reverse(A.at(i).begin(), A.at(i).end());
  }
  vector<pair<int64_t, int64_t>> Q;
  auto check = [&](int i) {
    if (A.at(i).size() == 0)
      return;
    int j = A.at(i).back();
    if (A.at(j).size() == 0)
      return;
    if (A.at(j).back() == i)
    {
      if (i > j)
        swap(i, j);
      Q.push_back({i, j});
    }
  };
  for (int i = 0; i < N; i++)
  {
    check(i);
  }
  int64_t day = 0;
  while (Q.size())
  {
    day++;
    sort(Q.begin(), Q.end());
    Q.erase(unique(Q.begin(), Q.end()), Q.end());
    vector<pair<int64_t, int64_t>> prevQ;
    swap(Q, prevQ);
    for (auto p : prevQ)
    {
      int64_t i, j;
      tie(i, j) = p;
      A.at(i).pop_back();
      A.at(j).pop_back();
    }
    for (auto p : prevQ)
    {
      int64_t i, j;
      tie(i, j) = p;
      check(i);
      check(j);
    }
  }
  for (int i = 0; i < N; i++)
  {
    if (A.at(i).size())
    {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << day << endl;
}


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

int p[11];

int main() {
    int N, sum_p = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        sum_p += p[i];
    }
    sort(p, p + N);
    sum_p -= p[N - 1];
    sum_p += p[N - 1] / 2;
    cout << sum_p << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

memo = ['' for i in xrange(45)]


def recursion(n):
    if n == 0 or n == 1:
        return 1

    return recursion(n - 1) + recursion(n - 2)


def memo_search(n):
    if memo[n] != '':
        return memo[n]
    else:
        if n == 0 or n == 1:
            memo[n] = 1
            return 1
        memo[n] = memo_search(n - 1) + memo_search(n - 2)
        return memo[n]

if __name__ == '__main__':
    n = input()
    # print recursion(n)
    print memo_search(n)

Measured memory_bytes: 6380
def solve():
    h, w = map(int, input().split())
    al = [list(input()) for _ in range(h)]
    ans = [[0 for _ in range(w)] for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if al[i][j] == "#":
                ans[i][j] = "#"
                continue
            cnt = 0
            for k in range(-1, 2):
                for l in range(-1, 2):
                    if k == 0 and l == 0:
                        continue
                    if 0 <= i+k < h and 0 <= j+l < w:
                        if al[i+k][j+l] == "#":
                            cnt += 1
            ans[i][j] = str(cnt)
    for line in ans:
        print("".join(line))


if __name__=="__main__":
    solve()

Measured memory_bytes: 42864
using System;

public class Test
{
    
	public static void Main()
	{
	    int a,b,m,l;
	    string[] s = Console.ReadLine().Split();
	    a = int.Parse(s[0]);
	    b = int.Parse(s[1]);
	    m = a * b;
	    l = a *2 + b *2;
	    Console.WriteLine("{0} {1}",m,l);
	    return ;
	    
	}
    
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define rreps(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
//#define int long long

signed main(){
    int n; string s;
    cin >> n >> s;
    
    vector<int> W(n+2,0), E(n+2,0);
    reps(i,1,n){
        W[i] = W[i-1];
        if(s[i-1]=='W') W[i]++;
    }
    rreps(i,n,1){
        E[i] = E[i+1];
        if(s[i-1]=='E') E[i]++;
    }
    
    int ans = INT_MAX;
    reps(i,1,n){
        ans = min(ans, W[i-1] + E[i+1]);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3076
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var d = int.Parse(spl[0]);
        var t = int.Parse(spl[1]);
        var s = int.Parse(spl[2]);

        return s * t >= d ? Yes : No;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27444
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
 
using ll = long long;
using namespace std;
 
int main() {
    int X,A,B; cin >> X >> A >> B;
 
    if(B-A <= 0){
      cout << "delicious" << endl;
    } else if(B-A <= X){
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 256
while true
	a,op,b = gets.split.map(&:to_s)

	case op
	when "?" then
		break
	when "+" then
		puts a.to_i + b.to_i
	when "-" then
		puts a.to_i - b.to_i
	when "*" then
		puts a.to_i * b.to_i
	when "/" then
		puts a.to_i / b.to_i
	else
		break
	end
end

Measured memory_bytes: 6096
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	vvi a(3,vi(3));
	rep(i,3)rep(j,3) cin >> a[i][j];
	int n; cin >> n;
	vi b(n); rep(i,n) cin >> b[i];
	vvi hole(3,vi(3,0));
	rep(q,n){
		rep(i,3)rep(j,3){
			if(b[q]==a[i][j]) hole[i][j]=1;
		}
	}
/* 	rep(i,3){
		rep(j,3) cout << hole[i][j] << "";
		cout << endl;
	} */
	bool bingo=false;
	rep(i,3){
		if(hole[i][0]*hole[i][1]*hole[i][2]) bingo = true;
	}
	rep(j,3){
		if(hole[0][j]*hole[1][j]*hole[2][j]) bingo = true;
	}
	if(hole[0][0]*hole[1][1]*hole[2][2]) bingo = true;
	if(hole[0][2]*hole[1][1]*hole[2][0]) bingo = true;

	if(bingo) cout << "Yes" << endl;
	else cout << "No" << endl;
}




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

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	Scanner sc = new Scanner(System.in);

	int INF = 1 << 28;
	double EPS = 1e-9;

	int n;
	int[] m;
	int[][] xs,ys;
	
	void run() {
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			m=new int[n+1];
			xs=new int[n+1][];
			ys=new int[n+1][];
			for(int j=0;j<=n;j++){
				m[j]=sc.nextInt();
				xs[j]=new int[m[j]];
				ys[j]=new int[m[j]];
				for(int i=0;i<m[j];i++){
					xs[j][i]=sc.nextInt();
					ys[j][i]=sc.nextInt();
				}
			}
			solve();
		}
	}

	void solve() {
		for(int i=1;i<=n;i++){
			//debug("i",i);
			if(m[0]==m[i]&&match(m[0],xs[0],ys[0],xs[i],ys[i])){
				println(i+"");
			}
		}
		println("+++++");
	}

	boolean match(int m,int[]xs1,int[]ys1,int[]xs2,int[]ys2){
		// vx,0
		// vx,0
		// -vx,0
		// 0,vx
		// 0,-vx
		
		int[][][]a={
				{
					{1,0},
					{0,1}
				},
				{
					{0,-1},
					{1,0}
				},
				{
					{-1,0},
					{0,-1}
				},
				{
					{0,1},
					{-1,0}
				}
		};
		
		int k1=-1,k2=-1;
		
		for(int j=0;j<4;j++){
			int vx1=xs1[1]-xs1[0];
			int vy1=ys1[1]-ys1[0];
			int vx2=xs2[1]-xs2[0];
			int vy2=ys2[1]-ys2[0];
			if(vx1*a[j][0][0]+vy1*a[j][0][1]==vx2&&
					vx1*a[j][1][0]+vy1*a[j][1][1]==vy2){
				k1=j;
			}
			int vx3=xs2[m-2]-xs2[m-1];
			int vy3=ys2[m-2]-ys2[m-1];
			if(vx1*a[j][0][0]+vy1*a[j][0][1]==vx3&&
					vx1*a[j][1][0]+vy1*a[j][1][1]==vy3){
				k2=j;
			}
		}
		
		//debug(k1,k2);
		
		if(k1==-1&&k2==-1){
			return false;
		}
		
		boolean f1=k1!=-1,f2=k2!=-1;
		
		for(int i=0;i<m-1;i++){
			int vx1=xs1[i+1]-xs1[i];
			int vy1=ys1[i+1]-ys1[i];
			int vx2=xs2[i+1]-xs2[i];
			int vy2=ys2[i+1]-ys2[i];
			int vx3=xs2[m-i-2]-xs2[m-i-1];
			int vy3=ys2[m-i-2]-ys2[m-i-1];
			if(k1!=-1){
				f1&=vx1*a[k1][0][0]+vy1*a[k1][0][1]==vx2&&
				vx1*a[k1][1][0]+vy1*a[k1][1][1]==vy2;
			}
			if(k2!=-1){
				f2&=vx1*a[k2][0][0]+vy1*a[k2][0][1]==vx3&&
				vx1*a[k2][1][0]+vy1*a[k2][1][1]==vy3;
			}
		}
		
		return f1||f2;
	}
	
	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s) {
		System.out.print(s);
	}

	void println(String s) {
		System.out.println(s);
	}

	public static void main(String[] args) {
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

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

typedef struct node {
    int H, W;
    struct node *next;
} node;


int main()
{
    node *head = NULL, *cur = NULL;

    while( 1 ){
        //メモリ確保
        node *new = (node *)malloc(sizeof(node));
        if( new == NULL ) fprintf(stderr, "ERROR! : malloc\n"), exit(-1);

        //標準入力
        scanf("%d %d", &new->H, &new->W);
        new->next = NULL;

        //終了判定
        if( new->H == 0 && new->W == 0 ) break;

        //連結
        if( head == NULL ) head = new;
        else cur->next = new;
        cur = new;
    }

    //標準出力
    cur = head;
    while( cur ){
        int i, j;
        for( i = 0; i < cur->H; ++i ){
            for( j = 0; j < cur->W; ++j ){
                if( i % (cur->H-1) == 0 || j % (cur->W-1) == 0 ) printf("#");
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
        cur = cur->next;
    }

    return 0;
}

Measured memory_bytes: 572
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int M = scan.nextInt();
        long ans = 0;
        int[] H = new int[N];
        for(int i=0;i<N;i++){
            H[i]=scan.nextInt();
        }
        Arrays.sort(H);
        for(int i=0;i<N-M;i++){
            ans+=H[i];
        }
        System.out.println(ans);
    }
}


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

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 1000000007;
using mint = Fp<MOD>;

int main(){
    ll n,k; cin >> n >> k;
    mint ans=0;
    for(ll i=k;i<=n+1;i++){
        mint mi=i*(i-1)/2;
        mint ma=i*(2*n-i+1)/2;
        ans += ma-mi+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <list>
#include <string>
using namespace std;

int main() {
	// your code goes here
	int n,k;
	string s;
	cin >>n;
	list<int> lst;
	for(int i=0;i<n;i++){
		auto it=lst.begin();
		cin>>s;
		if(s=="insert"){ 
			cin>>k;
			lst.push_front(k);
		}
		
		else if(s=="delete"){
			cin>>k;
		 	for(auto it=lst.begin();it!=lst.end();it++){
			 	if(*it==k){
			 		it=lst.erase(it);
			 		break;
		 		}
		 	}
		}else if(s=="deleteFirst"){
			lst.pop_front();
		}else if(s=="deleteLast"){
			lst.pop_back();
		}
	}
	for(auto it=lst.begin();it!=lst.end();it++){
		 if(it!=lst.begin()) cout<< " ";
		 cout <<*it;
 	}cout<<endl;
	return 0;
}

Measured memory_bytes: 34376
s=input()
l=len(s)

mod=10**9+7

dp=[[0 for j in range(13)] for i in range(l)]

if s[0] =="?":
    dp[0] = [1]*10+[0]*3
else:
    dp[0][int(s[0])] =1

for i in range(1, l):
 if s[i]=='?':
   for j in range(10):
     for k in range(13):
       dp[i][(k*10+j)%13]+=dp[i-1][k]%mod
 else:
   for k in range(13):
     dp[i][(k*10+int(s[i]))%13]+=dp[i-1][k]%mod
print(dp[-1][5]%mod)


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

vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int n;
	cin >> n;
	vector<int> d(n*2);
	for(int i = 0;i < n*2;i++){
		cin >> d[i];
	}
	bool yes = false;
	for(int i = 0;i < n*2-5;i+=2){
		if(d[i] == d[i+1]){
			if(d[i+2] == d[i+3]){
				if(d[i+4] == d[i+5]){
					yes = true;
				}
			}
		}
	}
	if(yes){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;

static const double eps = 1e-8;

int main(){
	int n;
	while(~scanf("%d",&n)){
		int* cards = new int[2*n]();
		int* cardA = new int[2*n]();
		int* cardB = new int[2*n]();

		for(int i=0;i<2*n;i++){
			cards[i]=i+1;
		}

		int m;
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			int k;
			scanf("%d",&k);
			if(k==0){
				for(int i=0;i<n;i++){
					cardA[i]=cards[i];
				}
				for(int i=0,j=n;i<n;i++,j++){
					cardB[i]=cards[j];
				}

				for(int i=0;i<n;i++){
					cards[2*i] = cardA[i];
					cards[2*i+1] = cardB[i];
				}
			}
			else{
				for(int i=0;i<k;i++){
					cardA[i] = cards[i];
				}
				for(int i=k,j=0;i<2*n;i++,j++){
					cardB[j] = cards[i];
				}

				for(int i=0;i<2*n-k;i++){
					cards[i] = cardB[i];
				}

				for(int i=2*n-k,j=0;i<2*n;i++,j++){
					cards[i] = cardA[j];
				}
			}
		}

		for(int i=0;i<2*n;i++){
			printf("%d\n",cards[i]);
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
int n,l;
cin >>n>>l;
string s[n];
for(int i=0;i<n;i++){
  cin >>s[i];
}
sort(s,s+n);
for(int i=0;i<n;i++) cout <<s[i];
cout <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    long long q,h,s,d;
    cin>>q>>h>>s>>d;
    long long one = min(4*q,min(h*2,s));
    long long two = min(2*one,d);
    long long n;
    cin>>n;
    long long ans = (n/2)*two;
    if(n%2) ans += one;
    cout<<ans<<'\n';
    return 0;
}



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


int main(){
    string S;
    cin >> S;
    bool sim = true;
    if(S.at(2)!=S.at(3)||S.at(4)!=S.at(5)) sim = false;
    if(sim) cout << "Yes" << endl;
    else cout << "No" << endl; 
}

Measured memory_bytes: 256
from sys import stdin

input = stdin.readline


def main():
    input()
    *A, = map(int, input().split())
    *B, = map(int, input().split())
    pre = A[0]
    ans = 0
    for a, b in zip(A[1:], B):
        tmp1 = pre if pre < b else b
        b -= tmp1
        tmp2 = a if a < b else b
        ans += tmp1 + tmp2
        pre = a - tmp2
    print(ans)
    return


main()


Measured memory_bytes: 18624
times = gets.chomp.to_i
for t in 0..times-1
	nk = gets.chomp.split()
	n = nk[0].to_i
	k = nk[1].to_i

	ary = gets.chomp.split()

	margin = Array.new
	ary[0] = ary[0].to_i
	for i in 0..n-2
		ary[i+1] = ary[i+1].to_i
		margin.push(ary[i+1] - ary[i])
	end
	margin.sort!
	#p ary,margin,n,k 					#?¢??????¨
	sum = 0
	for j in 0..n-1-k
		sum += margin[j]
	end
	puts sum
end

Measured memory_bytes: 24484
#include<stdio.h>
int main()
{
	int i,j,k;
	char r[99],g[99],d[99],c;
	while(scanf("%s%s%s",r,g,d)==3)
	{
		i=j=k=0;
		c=g[j++];
		while(d[k])
		{
			if(d[k]==c)
			{
				++k;
				c=r[i++];
			}
			else
			{
				putchar(c);
				if(!g[j])
				{
					c=0;
					break;
				}
				c=g[j++];
			}
		}
		if(c)putchar(c);
		while(g[j])putchar(g[j++]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	int N;
	cin >> N;
	vector<ll> p(N);
	rep(N){
	    int tmp;
	    cin >> tmp;
	    p[tmp - 1] = (i+1);
	}
    
    rep(N) cout << 30000*(i+1) << " ";
    cout << endl;
	rep(N) cout << 30000*(N-i) + p[i] << " ";
	cout << endl;
}


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

int main() {

    int n;
    char s[10001];
    scanf("%d %s", &n, s);

    for (int i = 0; i < strlen(s); i++) {

        char c = s[i];

        if (c + n >= 91) {
            c += n - 26;
        } else {
            c += n;
        }

        s[i] = c;
        //printf("%c %c %d\n", c, c + n, c + n);
    }
    printf("%s", s);


    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define test  ll t;cin >> t;for(ll index=1; index<=t; index++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//#define N 100005
#define N 300005
const int INF = 1000000001;
const int MOD = 998244353 ; //1e9+7;

 
void solve()
{
    ld n, x ,t;
    cin >> n >> x >> t;
    cout << (int)(ceil(n/x)*t) << "\n";
}

int main()
{
    fast;
    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //test{
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
    double t, x; cin >> t >> x;
    cout << fixed << setprecision(10) << t / x << endl;
}

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

int main()
{
  int N ;
  cin>>N ;
  vector<int>a(N) ;
  for(int i=0;i<N;i++) cin>>a[i] ;
  
  /*配列を大きい順にソート*/
  sort(a.begin(),a.end()) ;
  reverse(a.begin(),a.end()) ;
  
  int A_hand=0,B_hand=0;
  for(int i=0;i<N;i++){
    if(i%2==0) A_hand+=a.at(i) ;
    else B_hand+=a.at(i) ;
  }
  
  cout<<A_hand-B_hand<<endl ;

  return 0 ;
}


Measured memory_bytes: 256
K, N = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

dmx = K - A[N-1] + A[0]

for i in range(1, N):
    d = A[i] - A[i - 1]
    if d > dmx:
        dmx = d

print(K - dmx)

Measured memory_bytes: 26420
S=input()

if int(S[2:4])>0 and int(S[2:4])<=12:
    if int(S[0:2])>0 and int(S[0:2])<=12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if int(S[0:2])>0 and int(S[0:2])<=12:
        print('MMYY')
    else:
        print('NA')

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    V<ll> a(n);
    cinf(n,a);
    V<P> p(m);
    rep(i,m){
        ll b,c;
        cin>>b>>c;
        p[i]=make_pair(c,b);
    }
    sort(all(a));
    sort(all(p),greater<P>());
    ll k=0;
    ll ans=0;
    rep(i,m){
        ll x=lb(a.begin()+k,a.end(),p[i].ft)-a.begin();
        if(p[i].sc>=x-k){
            ans+=p[i].ft*(x-k);
            k=x;
            break;
        }else{
            ans+=p[i].ft*p[i].sc;
            k+=p[i].sc;
        }
    }
    for(int i=k;i<n;i++) ans+=a[i];
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え(=でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

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

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a) >> abs(x-b)) cout << 'A' << endl;
    else cout << 'B' << endl;
    
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, k, ans = INF;
  cin >> n >> k;
  vector<int> x(n);
  rep(i, n) cin >> x[i];

  for (int i = 0; i < n - k + 1; ++i)
    ans = min({abs(x[i]) + abs(x[i + k - 1] - x[i]),
               abs(x[i + k - 1]) + abs(x[i + k - 1] - x[i]), ans});

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


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;
#define PI 3.14159265358979323846

using namespace std;
int MOD = 1000000007;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  string ret = s.substr(0,3);
  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 3052
s,t=input(),input()
s_set,t_set,st_set=set(),set(),set()
for i,j in zip(s,t):
    if i not in s_set and j not in t_set:
        s_set.add(i)
        t_set.add(j)
    elif (i,j) not in st_set:
        print("No")
        break
    st_set.add((i,j))
else:
    print("Yes")


Measured memory_bytes: 3760
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
vll a;
lli ans;

void output(){
    cout << a[0];
    for(lli i = 1;i < n;i++){
        cout << " " << a[i];
    }
    cout << endl;
}

int main(){
    cin >> n;
    a = vll(n);
    for(lli i = 0;i < n;i++) cin >> a[i];
    for(auto itr = a.begin();itr < a.end();itr++){
        auto jtr = min_element(itr,a.end());
        if(itr == jtr) continue;
        swap(*itr,*jtr);
        ans++;
    }
    output();
    cout << ans << endl;
}

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

int main() {
  vector<int> hills;
  for (int i = 0; i < 10; i++) {
    int x;
    cin >> x;
    hills.push_back(x);
  }
  sort(hills.begin(), hills.end(), greater<int>());
  for (int i = 0; i < 3; i++) {
    cout << hills[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3108
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [n, w] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    putStrLn $ replicate (w + 2) '#'
    replicateM_ n $ do
        s <- getLine
        putStrLn $ "#" ++ s ++ "#"
    putStrLn $ replicate (w + 2) '#'


Measured memory_bytes: 1020
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion


//ABC  059-A 

int main(void) {
	char s[11],c;
	
	c = 'a'-'A';
	for (int i = 0; i < 3; i++){
		scanf("%s", s);
	    s[0] -= (char)c;
	    printf("%c",s[0]);
    }
	printf("\n");
	return 0;
	
}





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

int main(){
  string S,T;
  int A,B;
  string U;
  cin >> S >> T >> A >> B >> U;
  
  if(S==U){
    cout << A-1 << " " << B << endl;
  }
  else{
    cout << A << " " << B-1 << endl;
  }
}


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

template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};
using namespace std;
void solve(){
     string s;
     cin>>s;
     string y=s;
     int c=0;
     for(int i=1;i<s.size();i++){
         if(s[i]==s[i-1]){
           c++; if(s[i]=='1')s[i]='0';else s[i]='1';

          }  
     }
       int u=0;
      s=y;
     for(int i=s.size();i>0;i--)
     {
           if(s[i]==s[i-1]){
             u++;
             if(s[i-1]=='1')s[i-1]='0';else s[i-1]='1';
           }
     }
     cout<<min(u,c);
}

int main(){
    std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int sum(int z) {
	int wa = 0;
	for (int i = 1; i <= z; i++) {
		wa += i;
	}
	return wa;
}
int main(void)
{
	int a, b,x,sa=0;
	scanf("%d%d", &a, &b);
	sa = b - a;
	x = sum(sa) - b;
	printf("%d", x);
	return 0;
}

Measured memory_bytes: 128
def reach(s, x, y):
    for i in range(x, y-1):
        if s[i] == "#" and s[i+1] == "#":
            return False
    return True
def search(s, x, y):
    for i in range(x-1, y):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            return True
        if s[i] == "#" and s[i+1] == "#":
            break
    return False

def main():
    n, a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input().rstrip()
    if reach(s, a, c) and reach(s, b, d):
        if c < d:
            print("Yes")
        else:
            if search(s, b, d):
                print("Yes")
            else:
                print("No")

    else:
        print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
	int N; cin >> N;
	string S; cin >> S;
	int ans = 0;
	int x = 0;
	rep(i,N){
		if(S[i] == 'I'){
			x++;
			ans = max(ans,x);
		}
		else{
			x--;
		}
	}
	cout << ans << endl;
}



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

int main() {

  int N, A, B;
  cin >> N >> A >> B;

  int r = 0;

  for (int i = 1; i <= N; i++) {

    int v = i;
    int sum = 0;

    if (10000 <= v) {
      sum += v / 10000;
      v = v % 10000;
    }

    if (1000 <= v) {
      sum += v / 1000;
      v = v % 1000;
    }

    if (100 <= v) {
      sum += v / 100;
      v = v % 100;
    }

    if (10 <= v) {
      sum += v / 10;
      v = v % 10;
    }

    sum += v;

    if (A <= sum && sum <= B) {
      r += i;
    }

  }

  cout << r << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int M = sc.nextInt();

		int[] a = new int[A];
		int min_a = Integer.MAX_VALUE;
		for(int i=0; i<A; i++) {
			a[i] = sc.nextInt();
			min_a = Math.min(min_a, a[i]);
		}

		int[] b = new int[B];
		int min_b = Integer.MAX_VALUE;
		for(int i=0; i<B; i++) {
			b[i] = sc.nextInt();
			min_b = Math.min(min_b, b[i]);
		}

		//最小値を先に計算
		int min = min_a + min_b;

		int ans = min;
		//割引券を使った時と比較
		for(int i=0; i<M; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int c = sc.nextInt();

			ans = Math.min(ans, a[x-1]+b[y-1]-c);
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 131340
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[allow(unused_imports)]
use std::cmp::*;
trait Each: Iterator{
    fn each<F>(self, mut f: F) where
        Self: Sized, F: FnMut(Self::Item),
    {
        self.fold((), move |(), item| f(item));
    }
}
impl<T:Iterator>Each for T{}

fn main(){
    input!{
        s:String,
    }
    let s = match &s[..]{
        "Sunny" => "Cloudy",
        "Cloudy" => "Rainy",
        "Rainy" => "Sunny",
        _ => unreachable!(),
    };
    println!("{}",s);
}

Measured memory_bytes: 4352
#include <stdio.h>

int main(){
	int ans = 0;
	char cup1,cup2;
	while(scanf("%c,%c",&cup1,&cup2) != EOF){
		if(cup1 == 'A' && cup2 == 'B'){
			if(ans == 0){
				ans = 1;
			}else if(ans == 1){
				ans = 0;
			}
		}if(cup1 == 'B' && cup2 == 'A'){
			if(ans == 0){
				ans = 1;
			}else if(ans == 1){
				ans = 0;
			}
		}if(cup1 == 'C' && cup2 == 'B'){
			if(ans == 2){
				ans = 1;
			}else if(ans == 1){
				ans = 2;
			}
		}if(cup1 == 'B' && cup2 == 'C'){
			if(ans == 2){
				ans = 1;
			}else if(ans == 1){
				ans = 2;
			}
		}if(cup1 == 'A' && cup2 == 'C'){
			if(ans == 0){
				ans = 2;
			}else if(ans == 2){
				ans = 0;
			}
		}if(cup1 == 'C' && cup2 == 'A'){
			if(ans == 0){
				ans = 2;
			}else if(ans == 2){
				ans = 0;
			}
		}
	}
	printf("%c\n",ans + 'A');
	return 0;
}

Measured memory_bytes: 972
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}
string trans(int N)
{
        string S;
        while (N != 0)
        {
                if (N % 2 == 1)
                {
                        N--;
                        S = '1' + S;
                }
                else
                {
                        S = '0' + S;
                }
                N /= 2;
        }
        return S;
}

int main() //input->compute->output
{
        string N, T;
        cin >> N >> T;
        string ans = "";

        for (int i = 0; i < N.size(); i++)
        {
                if (i >= T.size())
                {
                        ans = ans + N[i];
                }
                else
                {
                        ans = ans + N[i] + T[i];
                }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256