akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
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 V>typename enable_if<is_class<T>::value==0>::type fill_v(T &t, const V &v){ t = v; }
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

LL x, y, z, k;
LL a[1010], b[1010], c[1010];

int main(){
    INIT;
    cin >> x >> y >> z >> k;
    REP(i, x)cin >> a[i];
    REP(i, y)cin >> b[i];
    REP(i, z)cin >> c[i];
    vector<LL> v;
    REP(i, x){
        REP(j, y){
            v.emplace_back(a[i] + b[j]);
        }
    }
    sort(ALL(v));
    reverse(ALL(v));
    vector<LL> v2;
    REP(i, min(k, x*y)){
        REP(j, z){
            v2.emplace_back(v[i] + c[j]);
        }
    }
    sort(ALL(v2));
    reverse(ALL(v2));
    REP(i, k){
        cout << v2[i] << endl;
    }
}

Measured memory_bytes: 43364
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static void exec(MyScanner in, PrintWriter out) {
		/* int N = */in.nextInt();
		int A = in.nextInt();
		int B = in.nextInt();
		out.println(A % 2 == B % 2 ? "Alice" : "Borys");
	}

	public static void main(String[] args) {
		PrintWriter w = new PrintWriter(System.out);
		exec(new MyScanner(System.in), w);
		w.flush();
	}

	static class MyScanner {
		static final int BUFFER_SIZE = 1024;
		private final InputStream in;
		private final byte[] buffer = new byte[BUFFER_SIZE];
		private int point;
		private int readLength;
		MyScanner(InputStream in) {
			this.in = in;
		}
		private int readByte() {
			if (point < readLength) {
				int result = buffer[point];
				point += 1;
				return result;
			}
			try {
				readLength = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (readLength == -1) {
				return -1;
			}
			point = 1;
			return buffer[0];
		}
		static boolean isPrintableCharExceptSpace(int c) {
			return 33 <= c && c <= 126;
		}
		String next() {
			StringBuilder b = new StringBuilder();
			int c = readByte();
			while (!(c == -1 || isPrintableCharExceptSpace(c))) {
				c = readByte();
			}
			if (c == -1) {
				throw new NoSuchElementException();
			}
			do {
				b.appendCodePoint(c);
				c = readByte();
			} while (c != -1 && isPrintableCharExceptSpace(c));
			return b.toString();
		}
		long nextLong() {
			int c = readByte();
			while (!(c == -1 || isPrintableCharExceptSpace(c))) {
				c = readByte();
			}
			if (c == -1) {
				throw new NoSuchElementException();
			}
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long result = 0L;
			do {
				if (!('0' <= c && c <= '9')) {
					throw new InputMismatchException();
				}
				result = result * 10L + (c - '0');
				c = readByte();
			} while (c != -1 && isPrintableCharExceptSpace(c));
			return minus ? -result : result;
		}
		int nextInt() {
			long n = nextLong();
			if (Integer.MIN_VALUE <= n && n <= Integer.MAX_VALUE) {
				return (int) n;
			}
			throw new InputMismatchException();
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}


Measured memory_bytes: 22868
def main():
    n, x = map(int, input().split())

    remainder = n - (2 * x)

    if remainder == 0:
        print(3 * x)
        return

    if remainder < 0:
        n, x = x, (n - x)
    else:
        n -= x

    ans = 0
    while True:
        num = n // x
        ans += (3 * x) * num
        rem = n % x
        if rem == 0:
            break
        n, x = x, rem
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define nes ios_base :: sync_with_stdio(0); cin.tie(0);
using namespace std;
ll mo=1e9+7;
ll mod(ll n){
	return (n%mo+mo)%mo;
}
ll modadd(ll a,ll b){
	return mod(mod(a)+mod(b));
}
int main(){
	nes;
	int n;
	cin>>n;
	vector<int>v1(n),v2(n);
	for(int i=0;i<n;++i){
		int x,y;
		cin>>x>>y;
		v1[i]=x+y;
		v2[i]=x-y;
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	cout<<max(v1[n-1]-v1[0],v2[n-1]-v2[0]);
	return 0;
}

Measured memory_bytes: 4760
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    
    int n;
    cin >> n;
    vector <string> s(n);
    vector <int> p(n);
    rep(i,n) cin >> s[i] >> p[i];

    vector <string> st = s;
    vector <int> po = p;

    for (int i=0; i < n-1; i++){
        for (int j=i+1; j < n; j++){
            if (s[j] < s[i]){
                swap(s[i], s[j]);
                swap(p[i], p[j]);
            }
            else if (s[i] == s[j] && p[i] < p[j]){
                swap(s[i], s[j]);
                swap(p[i], p[j]);
            }
        }
    }

    rep(i,n){
        rep(j,n){
            if (st[j] == s[i] && po[j] == p[i]) cout << j+1 << endl;
        }
    }
    

}





//              g++ -std=c++1z


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());

        var st = 0;
        var sx = 0;
        var sy = 0;

        for (int i = 0; i < n; i++)
        {
            var txy = Console.ReadLine().Split(' ');
            var t = int.Parse(txy[0]);
            var x = int.Parse(txy[1]);
            var y = int.Parse(txy[2]);

            var d = t - st - Math.Abs(sx - x) - Math.Abs(sy - y);

            if (0 <= d && d % 2 == 0)
            {
                st = t;
                sx = x;
                sy = y;
            }
            else
            {
                Console.WriteLine("No");
                return;
            }
        }

        Console.WriteLine("Yes");
    }
}


Measured memory_bytes: 17232
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}

ll a[maxn];
int main()
{
    int n;
    ll x;
    while(cin>>n>>x)
    {
        FOR(i,0,n)cin>>a[i];
        sort(a,a+n);
        int x1 = lower_bound(a,a+n,x) - a;
        //cout<<x1<<endl;
        ll d;
        if(x1 == 0)
            d = a[x1] - x;
        else if(x1 == n)
            d = x - a[x1-1];
        else
            d = gcd(a[x1] - x, x - a[x1-1]);
        FOR(i,0,n-1)
        d = gcd(d, a[i+1] - a[i]);
        cout<<d<<endl;
    }


}
















Measured memory_bytes: 1024
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

N,K = mint()
C = counter()
for _ in range(N):
    a,b = mint()
    C.add(a,b)
L = []
for k in C:
    L.append([k,C[k]])
L.sort(key=lambda x:x[0])
tmp = 0
for l in L:
    tmp += l[1]
    if tmp>=K:
        print(l[0])
        exit()

Measured memory_bytes: 88932
#include <stdio.h>

int main(void) {
	int H,W,i,j,k;
	scanf("%d %d",&H,&W);

	char scan[W];
		for(j=0;j<H;j++){
			scanf("%s",scan);
			for(k=0;k<2;k++){
				for(i=0;i<W;i++){
					
					printf("%c",scan[i]);
				}
				printf("\n");
			}
		}

	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz size
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

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

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	ll a;
	ld b;
	cin>>a>>b;
	ll c = floor(a * b);
	cout<<c<<"\n";
	return;
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main(){
string t;
  cin>>t;
  int l=t.size();
  for(int i=0;i<l;i++){
    if(t[i]=='P'||t[i]=='D')continue;
    else t[i]='D';
  }
  cout<<t<<endl;
}
      
      

Measured memory_bytes: 3752
#include<cmath>
#include<queue>
#include<cstdio>

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

using namespace std;

const double EPS=1e-8;
const double INF=1e77;
const double PI=acos(-1);

struct state{
	double d;
	int pre,now,val;
	state(double d,int pre,int now,int val):d(d),pre(pre),now(now),val(val){}
	bool operator<(const state &S)const{ return d>S.d; }
};

int main(){
	int n;
	double r,theta; scanf("%d%lf%lf",&n,&r,&theta);
	theta*=PI/180;

	int x[20],y[20];
	rep(i,n) scanf("%d%d",x+i,y+i);

	double dist[20][20];
	rep(i,n) rep(j,n) dist[i][j]=hypot(x[i]-x[j],y[i]-y[j]);

	static bool adj[20][20][20]; // 直前に i にいて今 j にいるとき k に行けるかどうか
	rep(i,n) rep(j,n) if(i!=j) rep(k,n) if(j!=k) {
		double phi=acos(((x[i]-x[j])*(x[k]-x[j])+(y[i]-y[j])*(y[k]-y[j]))/(dist[i][j]*dist[k][j]));
		if(PI-phi<=theta) adj[i][j][k]=true;
	}

	static double d[20][20][10001];
	rep(i,n) rep(j,n) rep(k,10001) d[i][j][k]=INF;
	priority_queue<state> Q;
	rep(i,n) if(i!=0 && dist[0][i]<=r) {
		d[0][i][1]=dist[0][i];
		Q.push(state(dist[0][i],0,i,1));
	}
	while(!Q.empty()){
		state S=Q.top(); Q.pop();
		double d_now=S.d;
		int pre=S.pre,now=S.now,val=S.val;

		if(d_now>d[pre][now][val]+EPS) continue;

		rep(nxt,n) if(adj[pre][now][nxt]) {
			double d_next=d_now+dist[now][nxt];
			if(d_next<=r && d_next+EPS<d[now][nxt][val+1]) {
				d[now][nxt][val+1]=d_next;
				Q.push(state(d_next,now,nxt,val+1));
			}
		}
	}

	int ans=0;
	rep(i,n) rep(j,n) rep(k,10001) if(d[i][j][k]<=r) ans=max(ans,k);
	printf("%d\n",ans);

	return 0;
}

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

int main() {
	int arr[3];
	scanf("%d%d%d",&arr[0],&arr[1],&arr[2]);
	
	sort(arr,arr+3);
	
	int ans = arr[2]*10+arr[1]+ arr[0];
	
	printf("%d\n",ans);
	
	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 int long long
const int inf = 1e17;
const int mod = 1000000007;
typedef pair<int, int> P;
typedef pair<int, P> PP;

signed main() {
	int n; cin >> n;
	int cnt = 1;
	int clr[3] = { 0,0,0 };
	rep(i, n) {
		int a; cin >> a;
		sort(clr, clr + 3);
		int cntb = 0;
		rep(j, 3)if (clr[j] == a)cntb++;
		cnt *= cntb;
		cnt %= mod;
		rep(j, 3) {
			if (clr[j] == a) {
				clr[j]++; break;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    int n,k,q,a,p[100000]={},i;
    scanf("%d%d%d",&n,&k,&q);
    for(i=0;i<q;i++){
        scanf("%d",&a);
        p[a-1]++;
    }
    for(i=0;i<n;i++){
        if(k+p[i]>q){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
  return 0;
}


Measured memory_bytes: 896
using System;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;
    class MainClass
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
          int[] line2 = new int[n];
          for(int i=0;i<n;i++)line2[i]= line[i];
            Array.Sort(line);
            int a1 = line[n / 2 - 1];
            int a2 = line[n/2];
             for(int i=0;i<n;i++)
             {
                if (line2[i] <= a1)
                {
                 Console.WriteLine(a2);
                }
		        else 
                {
			     Console.WriteLine(a1);
		        }
             }
        }
    }

Measured memory_bytes: 37980
import sys
import itertools
import numpy as np

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
basho = [LI() for _ in range(N)]
keiros = list(itertools.permutations(range(1,N+1)))
nagasa = []

for keiro in keiros:
    
    diff = 0
    for i in range(1,len(keiro)):
        
        diff += (((basho[keiro[i]-1][0] - basho[keiro[i-1]-1][0]) ** 2) + ((basho[keiro[i]-1][1] - basho[keiro[i-1]-1][1]) ** 2)) ** 0.5
        
    nagasa.append(diff)

num = np.array(nagasa)
print(np.average(num))


Measured memory_bytes: 33720
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int n;
char s[210];
char subs[210];

struct word
{
    char str[110];
    int l;
}w[110];
int len[110];

int dp0[2010];
int dp[2010];

void sub(int st,int ed)
{
    int i;
    for(i=st;i<=ed;i++)
        subs[i-st]=s[i];
    subs[i-st]='\0';
}

int main()
{
    int cou=1;
    while(~scanf("%d",&n)&&n)
    {
        for(int i=0;i<n;i++)
        {
            scanf("%s%d",w[i].str,&w[i].l);
            len[i]=strlen(w[i].str);
        }
        scanf("%s",s);
        int len0=strlen(s);
        int start=0;
        int v=0;
        for(int i=0;i<=len0;i++)
            dp0[i]=-1*(0x3f3f3f3f);
        dp0[0]=0;
        for(int i=1;i<=len0;i++)
        {
            for(int j=0;j<n;j++)
            {
                int ed=i-len[j];
                sub(ed,ed+len[j]-1);
                if(ed>=0&&dp0[ed]>=0&&strcmp(w[j].str,subs)==0)
                    dp0[i]=max(dp0[i],dp0[ed]+w[j].l);
            }
        }
        v=dp0[len0];
        for(int i=0;i<=v;i++)
            dp[i]=0x3f3f3f3f;
        dp[0]=0;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<=v;j++)
            {
                if(w[i].l<=j)
                    dp[j]=min(dp[j],dp[j-w[i].l]+len[i]);
            }
        }
        printf("Case %d: %d\n",cou++,dp[v]);
    }
    return 0;
}

Measured memory_bytes: 1224
#include <cstdio>
using namespace std;
int main()
{
	int a=0,b,i,j,n,m;
	char f[4];
	scanf("%s",&f);
	for(i=0;i<4;i++)
	{

		if(f[i]=='+')
		{
			a++;
		}
		else if(f[i]=='-')
		{
			a--;
		}
	}
	printf("%d",a);
} 

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <iostream>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

 

const int mod=1000000007;
//const int mod=998244353;
 

int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    long long int t,n,m,k,q,x,a,b,c,d,w;
    cin>>n>>m;
    cout<<min(n%m, m-n%m)<<"\n";
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e6;

int main() {
	ios_base::sync_with_stdio(0);
	int a,b,n,T,cas=0;
	char ch;
	cin>>ch;
	char ch2=ch+1;
	cout<<ch2;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2010;
ll a[N],n,b[N],ans;
ll dp[N][N];
ll m[N],vis[N];
bool cmp(ll a,ll b){
	return a>b;
}
int main()
{
	//freopen("in.txt","r",stdin);
	scanf("%lld",&n);
	for(ll i=1;i<=n;++i){
		scanf("%lld",&a[i]);
		//printf("%lld ",a[i]);
		b[i]=a[i];
	}
	//printf("\n");
	sort(b+1,b+n+1,cmp);
	for(ll i=1;i<=n;++i){
		for(ll j=1;j<=n;++j){
			if(b[i]==a[j]&&!vis[j]){
				vis[j]=1;
				m[i]=j;
				break;
			}
		}
	}
//	for(ll i=1;i<=n;++i){
//		printf("%lld\n",m[i]);
//	}
	for(ll s=1;s<=n;++s){
		dp[s][0]=dp[s-1][0]+b[s]*(m[s]-s);
		dp[0][s]=dp[0][s-1]+b[s]*(n+1-s-m[s]);
		//printf("i=%lld,dp[%lld][0]=%lld,dp[0][%lld]=%lld\n",m[s],s,dp[s][0],s,dp[0][s]);
		for(ll x=1,y=s-1;x<s;++x,--y){
			dp[x][y]=max(dp[x][y-1]+b[s]*(n+1-y-m[s]),dp[x-1][y]+b[s]*(m[s]-x));
			//printf("dp[%lld][%lld]=%lld\n",x,y,dp[x][y]);
		}
	}
	for(ll i=0;i<=n;++i){
		if(ans<dp[i][n-i]) ans=dp[i][n-i];
	}
	printf("%lld",ans);
}


Measured memory_bytes: 26540
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

ll H, W, V;
ll dy[8] = { 0,  0, -1, +1, -1, -1, +1, +1};
ll dx[8] = {-1, +1,  0,  0, -1, +1, -1, +1};

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  std::cin >> H >> W;
  std::vector<std::string> grid(H, std::string(W, 'x'));
  std::vector<std::string> ans(H, std::string(W, 'x'));
  for (ll y = 0; y < H; y++) {
    std::cin >> grid[y];
    ans[y] = grid[y];
  }


  for (ll y = 0; y < H; y++) {
    for (ll x = 0; x < W; x++) {
      if (grid[y][x] == '#') continue;
      ll cnt = 0LL;
      for (ll d = 0; d < 8; d++) {
	ll ny = y + dy[d];
	ll nx = x + dx[d];
	if (ny >= 0 && nx >= 0 && ny < H && nx < W) {
	  if (grid[ny][nx] == '#') cnt++;
	}
      }
      grid[y][x] = cnt + '0';
    }
  }

  for (ll y = 0; y < H; y++) {
    print(grid[y]);
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

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

    int n = gi();
    for (int i = 1; i < 50000; i++)
        if (i*108/100 == n) {
            printf("%d\n", i);
            return 0;
        }

    printf(":(\n");

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s1 = new String(sc.nextLine());
        String s2 = new String();
        int c=0;
        
        while(true){
        	s2 = sc.next();
        	if(s2.equals("END_OF_TEXT")){
        		sc.close();
        		break;
        	}
        	if(s2.equalsIgnoreCase(s1)){
        		c++;
        	}
        }
        System.out.println(c);
    }

}


Measured memory_bytes: 26160
n,m=map(int,input().split())
l=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

done=[False for i in range(n)]
ans=[-1 for i in range(n)]
def bfs():
  que=[0]

  while(que):
    now=que.pop(0)
    done[now]=True
    for i in l[now]:
      if done[i]==False:
        que.append(i)
        done[i]=True
        ans[i]=now+1
bfs()
print("Yes")
print(*ans[1:])


Measured memory_bytes: 38444
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 100005
int n,m,fa[MN],vis[MN],cnt,p[MN],ct;
long long a[MN],ans;
int findf(int x){return fa[x]==x?fa[x]:fa[x]=findf(fa[x]);}
void union_(int x,int y){x=findf(x);y=findf(y);fa[x]=y;return;}
vector<int> pic[MN];
int main(){
	n=read(),m=read();
	register int i,j,x,y;
	for(i=1;i<=n;i++) a[i]=read(),fa[i]=i;
	for(i=1;i<=m;i++){
		x=read()+1,y=read()+1;
		union_(x,y);
	}
	if(m==n-1) return puts("0"),0;
	if((n-m-1)*2>n) return puts("Impossible\n"),0;
	for(i=1;i<=n;i++){
		if(vis[findf(i)]) pic[vis[fa[i]]].push_back(a[i]);
		else pic[vis[findf(i)]=++cnt].push_back(a[i]);
	}
	for(i=1;i<=cnt;i++){
		sort(pic[i].begin(),pic[i].end()),ans+=pic[i][0];
		for(j=1;j<pic[i].size();j++) p[++ct]=pic[i][j];
	}
	sort(p+1,p+ct+1);
	for(i=1;i<=n-m-2;i++) ans+=p[i];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
const int maxn = 5005;
const int mod = 1e9+7;

int N;
string S;
int dp[maxn][maxn];

void add(int &a, int b) {
	a += b;
	a %= mod;
}

int fast_e(int x, int exp) {
	int ans = 1, base = x;
	while (exp) {
		if (exp & 1) ans = (ans * base) % mod;
		base = (base*base) % mod;
		exp >>= 1;
	}
	return ans;
}

int dpf(int x, int s) {
	if (dp[x][s] != -1) return dp[x][s];
	
	if (x == 0 and s == (int) S.length()) return 1ll;
	if (x == 0) return 0ll;
	
	dp[x][s] = 0;
	add(dp[x][s], dpf(x-1,max(0ll,s-1)));
	add(dp[x][s], 2*dpf(x-1,s+1));
	
	//cout << x << " " << s << " " << dp[x][s] << "\n";
	return dp[x][s];
}

int mi(int a, int b) {
	return (a * fast_e(b,mod-2)) % mod;
}

int32_t main() {
	FAST
	cin >> N >> S;
	memset(dp,-1,sizeof dp);
	//cout << dpf(N,0);
	cout << mi(dpf(N,0), fast_e(2,S.length())) % mod;
}








Measured memory_bytes: 196224
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
const char bn = '\n';
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
    os<<endl;
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, map<T,S> const&M){
    for(auto e:M){
        os<<e;
    }
    os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

int solve(string const& S, char c){
    int res = 0;
    auto T = S;
    while(count(ALL(T),c)!=T.size()){
        res++;
        string tmp(T.size()-1,'?');
        REP(i,T.size()-1){
            if(T[i]==c or T[i+1]==c) tmp[i]=c;
        }
        T=tmp;
        // debug(T)
    }
    return res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int ans=1000;
    REP(c,26){
        // debug((find(ALL(S),c+'a') == S.end()))
        if(find(ALL(S),c+'a') != S.end()) chmin(ans, solve(S,c+'a'));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int64_t n, a, b;
  cin >> n >> a >> b;
  if (n == 1) {
    if (a == b) cout << 1 << endl;
    else cout << 0 << endl;
  } else if (a > b) {
    cout << 0 << endl;
  } else {
    cout << (n - 2) * (b - a) + 1 << endl;
  }
}



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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    cout << setprecision(20);
    string s;
    cin >> s;

    if(s=="SUN") cout << 7 << endl;
    else if(s=="MON") cout << 6 << endl;
    else if(s=="TUE") cout << 5 << endl;
    else if(s=="WED") cout << 4 << endl;
    else if(s=="THU") cout << 3 << endl;
    else if(s=="FRI") cout << 2 << endl;
    else  cout << 1 << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
    r := bufio.NewReader(os.Stdin)

    var H, W, N, result int

    if _, e := fmt.Fscan(r, &H); e != nil {
    	return
	}
	if _, e := fmt.Fscan(r, &W); e != nil {
		return
	}
	if _, e := fmt.Fscan(r, &N); e != nil {
		return
	}

	if H > W {
		result = countOperation(H, N)
	} else {
		result = countOperation(W, N)
	}
	fmt.Println(result)
}

func countOperation(length, target int) int {
	result := target / length
	if target % length > 0 {
		result += 1
	}
	return result
}


Measured memory_bytes: 640
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
    ll n,a,b;
    std::cin >> n>>a>>b;
    vector<ll> x(n);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i];
    }
    ll res = 0;
    for (int i = 1; i < n; i++) {
        res += min( (x[i]-x[i-1])*a, b );
    }
    std::cout << res << std::endl;
}


Measured memory_bytes: 1024
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;


int mod(int n, int m) {
    if (n > 0) {
        return n % abs(m);
    }
    else {
        return (abs(m) - abs(n) % abs(m)) % abs(m);
    }
}

int main() {
    int n;
    cin >> n;
    if (n == 0) {
        cout << "0" << endl;
        return 0;
    }

    string ans;
    int m = n;
    while (m != 0) {
        int m1 = mod(m,  -2);
        ans.push_back((m1 + '0'));
        m -= m1;
        m /= -2;
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;

struct R{
    string s;
    int d , indx;
    bool operator <(const R &other) const{
        if(s == other.s)
            return d > other.d;
        return s < other.s;
    }
};

int main(){
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    int n;
    cin >> n;
    vector<R> a(n);
    for(int i = 0 ; i < n ; ++i){
        cin >> a[i].s >> a[i].d;
        a[i].indx = i + 1;
    }

    sort(all(a));

    for(int i = 0 ; i < n ; ++i)
        cout << a[i].indx << endl;
}


Measured memory_bytes: 256
s=input()+'R'
l=len(s)
ans=[0]*(l-1)
rcnt=0
lcnt=0
rpos=0
lpos=0
flag=0
for i in range(l):
  if s[i]=='R':
    if flag==1:
      if rcnt%2==0:
        ans[rpos]+=rcnt//2
        ans[lpos]+=rcnt//2
      else:
        ans[rpos]+=rcnt//2+1
        ans[lpos]+=rcnt//2
      if lcnt%2==0:
        ans[rpos]+=lcnt//2
        ans[lpos]+=lcnt//2
      else:
        ans[rpos]+=lcnt//2
        ans[lpos]+=lcnt//2+1
      rcnt=0
      lcnt=0
    flag=0
    rcnt+=1
    rpos=i
  elif s[i]=='L':
    if flag==0:
      lpos=i
    lcnt+=1
    flag=1
print(*ans)

Measured memory_bytes: 6400
//
// main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

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

int main() {
	ll N;
	cin >> N;
	string str;
	cin >> str;
	vector<ll> As(N);
	rep(i,0,N) {
		As[i] = str[i] - '0';
	}
	N--;
	vector<ll> Bs(N);
	rep(i,0,N) {
		Bs[i] = abs(As[i] - As[i+1]);
	}
	auto ord2 = [](ll x){
		ll ans = 0;
		while (x % 2 == 0) {
			ans++;
			x /= 2;
		}
		return ans;
	};
	vector<ll> binom_mod2(N);
	binom_mod2[0] = 1;
	ll numer_ord = 0;
	ll denom_ord = 0;
	rep(m,1,N) {
		numer_ord += ord2(N-m);
		denom_ord += ord2(m);
		assert(numer_ord >= denom_ord);
		if (numer_ord == denom_ord) {
			binom_mod2[m] = 1;
		}
	}
	ll ans_mod2 = 0;
	rep(i,0,N) {
		if (Bs[i] == 1) {
			ans_mod2 += binom_mod2[i];
		}
	}
	if (ans_mod2 % 2 == 1) {
		cout << 1 << endl;
		return 0;
	}
	rep(i,0,N) {
		if (Bs[i] == 1) {
			cout << 0 << endl;
			return 0;
		}
	}
	rep(i,0,N) {
		Bs[i] /= 2;
	}
	ans_mod2 = 0;
	rep(i,0,N) {
		if (Bs[i] == 1) {
			ans_mod2 += binom_mod2[i];
		}
	}
	if (ans_mod2 % 2 == 0) {
		cout << 0 << endl;
	} else {
		cout << 2 << endl;
	}
}



Measured memory_bytes: 24820
def main():

    import sys, math
    #from bisect import bisect_left as bl, bisect_right as br, insort
    #from heapq import heapify, heappush, heappop
    #from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
    # sys.setrecursionlimit(100000)
    INF = int(1e9)
    mod = int(1e9)+7

    a,b,c,k=mdata()
    if k>a:
        if k>b:
            print(a-(k-a-b))
        else:
            print(a)
    else:
        print(k)

if __name__ == '__main__':
    main()


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

int main(){
    int N,M,X,r0=0,r1=0,k;
    cin >> N >> M >> X ;

    for (int i=0;i<M;i++){
        cin >> k;
        if (k<X){
            r0 += 1;
        }
        else{
            r1 += 1;
        }
    }

    cout << min(r0,r1) << endl;
}
    //sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int X;
int Y;
char S[50][52];
int main(){
  int d, di[4]={-1, 1, 0, 0}, dj[4]={0, 0, -1, 1}, i, j, ni, nj;
  rd(X);
  rd(Y);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(X);Lj4PdHRW++){
      rd(S[Lj4PdHRW]);
    }
  }
  for(i=0;i<(X);i++){
    for(j=0;j<(Y);j++){
      if(S[i][j]=='#'){
        for(d=0;d<(4);d++){
          ni = i + di[d];
          nj = j + dj[d];
          if(0 <= ni  &&  ni < X && 0 <= nj  &&  nj < Y && S[ni][nj]=='#'){
            break;
          }
        }
        if(d==4){
          wt_L("No");
          wt_L('\n');
          return 0;
        }
      }
    }
  }
  wt_L("Yes");
  wt_L('\n');
  return 0;
}
// cLay varsion 20190827-1

// --- original code ---
// int X, Y;
// char S[50][52];
// {
//   int i, j, ni, nj, d;
//   int di[4] = {-1, 1, 0, 0}, dj[4] = {0, 0, -1, 1};
// 
//   rd(X,Y,S(X));
//   rep(i,X) rep(j,Y) if(S[i][j]=='#'){
//     rep(d,4){
//       ni = i + di[d];
//       nj = j + dj[d];
//       if(0 <= ni < X && 0 <= nj < Y && S[ni][nj]=='#') break;
//     }
//     if(d==4) wt("No"), return 0;
//   }
// 
//   wt("Yes");
// }


Measured memory_bytes: 256
/**
 *   author: Shubham Srivastava
 *   created: 18 August 2019  17:30:58
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n;cin>>n;
    string s;cin>>s;
    if(n>=3200)
        cout<<s;
    else
        cout<<"red";
return 0;
}

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

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>        P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	char C;
	cin >> C;
	C++;
	cout << C << endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define Pi 3.141592

typedef struct {

  double x;
  double y;

}St;

void kock (int,St,St);

main()
{
  int n;
  St p1,p2;

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;

  scanf("%d",&n);

 
  

  /*再起の中にprint文は含める*/
  printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);

  return 0;
}



void kock(int n,St p1,St p2)
{
  St s,u,t; 
  
  if(n == 0){
    return;
   
  }
  s.x = (2*p1.x + 1*p2.x)/3;
  s.y = (2*p1.y + 1*p2.y)/3;

  t.x = (1*p1.x + 2*p2.x)/3;
  t.y = (1*p1.y + 2*p2.y)/3;

  u.x = (t.x - s.x)*cos(Pi/3) - (t.y - s.y)*sin(Pi/3) + s.x ;
  u.y = (t.x - s.x)*sin(Pi/3) + (t.y - s.y)*cos(Pi/3) + s.y ;

  kock(n-1,p1,s);/*n==0ならばここは実質実行されない*/
  printf("%f %f\n",s.x,s.y);

  kock(n-1,s,u);
  printf("%f %f\n",u.x,u.y);

  kock(n-1,u,t);
  printf("%f %f\n",t.x ,t.y);

  kock(n-1,t,p2);


}

Measured memory_bytes: 636
#include <cstring>
#include<iostream>
#include <vector> 
#include <algorithm>
#include<iomanip>
#include<math.h>
#include<string>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;
struct Room {
	int* a;
	int shortest;
	int way;
	int ways;
};
//for (int x = 0; x < N; x++)room[x].a=(int*)malloc(room[x].way * sizeof(int));
int main() {
	int N,a=0,b=0,c=0,d=0;
	static char szBuf[10] = { 0 };
	cin >> N;
	for (int x = 0; x < N; x++) {
		cin >> szBuf;
		if (!strcmp(szBuf ,"AC"))a++;
		if (!strcmp(szBuf ,"WA"))b++;
		if (!strcmp(szBuf ,"TLE"))c++;
		if (!strcmp(szBuf ,"RE"))d++;
	}
	cout << "AC x " << a << endl << "WA x " << b <<endl<< "TLE x " << c <<endl<< "RE x " << d<<endl;
	return 0;
}

Measured memory_bytes: 3652
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,m = map(int,input().split())
x = list(map(int,input().split()))

from collections import Counter, defaultdict
c = Counter(x)
cc = defaultdict(list)
onum = defaultdict(int)
esum = defaultdict(int)
for k,v in c.items():
    cc[k%m].append(v)
    if v%2:
        onum[k%m] += 1
        esum[k%m] += v-1
    else:
        esum[k%m] += v
    
def sub(l, o):
    return sum(item//2 for item in l) + o//2
def sub2(l1, o1, l2, o2, e1, e2):
    if o1==o2:
        return sum(item//2 for item in l1) + sum(item//2 for item in l2) + o1
    elif o1<o2:
        o1, o2 = o2, o1
        l1, l2 = l2, l1
        e1, e2 = e2, e1
    ans = 0
    ans += o2
    o1 = o1 - o2
    if o1 <= e2:
        ans += o1
        e2 -= o1
        ans += (e1//2) + (e2//2)
    else:
        ans += e2
        ans += (e1//2)
    return ans

if m%2==0:
    ans = 0
    ans += sub(cc[0], onum[0])
    ans += sub(cc[m//2], onum[m//2])
    for k in range(1,m//2):
        ans += sub2(cc[k], onum[k], cc[m-k], onum[m-k], esum[k], esum[m-k])
else:
    ans = 0
    ans += sub(cc[0], onum[0])
    for k in range(1,m//2+1):
        ans += sub2(cc[k], onum[k], cc[m-k], onum[m-k], esum[k],  esum[m-k])
print(ans)

Measured memory_bytes: 140644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 100005;
const ll MOD = 1000000007;

int k, n;

/*********************GoodLuck***********************/
int main () {
    IOS();
    cin >> k >> n;

    vector<int> ans;

    if (k & 1) {
        ans = vector<int>(n, (k+1)/2);
        REP (i, n/2) {
            if (ans.back() == 1) {
                ans.pop_back();
            } else {
                ans.back()--;
                while (ans.size() < n) {
                    ans.emplace_back(k);
                }
            }
        }
    } else {
        ans = vector<int>(n, k);
        ans.front() = k/2;
    }

    REP (i, SZ(ans)) {
        cout << ans[i] << " \n"[i==SZ(ans)-1];
    }
}


Measured memory_bytes: 3456
#import numpy as np
import itertools
import time

N,M,R=map(int,input().split())
r=list(map(int,input().split()))

ROAD=[None]*M

for i in range(M):
    ROAD[i]=list(map(int,input().split()))


#Dis=np.full((N+1,N+1),float("inf"))

Dis=[None]*(N+1)
for i in range(1,N+1):
    Dis[i]=[100000000]*(N+1)

for i in range(M):
    Dis[ROAD[i][0]][ROAD[i][1]]=ROAD[i][2]
    Dis[ROAD[i][1]][ROAD[i][0]]=ROAD[i][2]



#ワーシャル–フロイド法を使って最短距離Disを求める

for k in range(1,N+1):#k個までの町を使ってのDisが知れているときに
    for i in range(1,N+1):#町iと
        for j in range(i,N+1):#町jとの最短距離は、
            length=Dis[i][k]+Dis[j][k]
            if Dis[i][j]>length:
                Dis[i][j]=length
                Dis[j][i]=length


  
PERM=list(itertools.permutations(r))



ANS=float("inf")
for i in range(len(PERM)):
    DIST=0
    for k in range(1,R):
        DIST+=Dis[PERM[i][k]][PERM[i][k-1]]
        if DIST>ANS:
            break
    if ANS>DIST:
        ANS=DIST

print(int(ANS))

Measured memory_bytes: 13180
#include<iostream>

using namespace std;
int main() {
  unsigned int Length, Width, Circumference, Area;    //縦　横　周囲　面積を宣言。
  cin >> Length >> Width;   //縦と横の長さを入力。
  Circumference = 2*(Length + Width);   //周囲を計算。
  Area = Length*Width;    //面積を計算。
  cout << Area << ' ' << Circumference << endl;   //面積と周囲の長さを出力。

}



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

int gcd(int a,int b){
    int r=a%b;
    if(r==0) return b;
    else return gcd(b,r);
}

int main(){
    int K,sum=0;
    cin>>K;
    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                int ij=gcd(i,j);
                int b=gcd(ij,k);
                sum+=b;
            }
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3636