akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  for(ll i = 0; i < h; i++) cin >> s[i];

  for(ll i = 0; i < w+2; i++) cout << '#';
  cout << endl;

  for(ll i = 0; i < h; i++){
    cout << '#' << s[i] << '#' << endl;
  }

  for(ll i = 0; i < w+2; i++) cout << '#';
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

using Number = long long;
using NumberSet = std::vector<Number>;
using NumberCount = std::unordered_map<Number, size_t>;
using Top2Count = std::pair<size_t, size_t>;

struct Count {
    Number number;
    size_t size;
};

void findTop2(const NumberCount& occurence, NumberSet& topNumbers, Top2Count& top2Count) {
    std::vector<Count> counts;
    for (const auto& element : occurence) {
        counts.push_back(Count{element.first, element.second});
    }

    std::sort(counts.begin(), counts.end(),
              [](const auto& lhs, const auto& rhs) { return lhs.size > rhs.size; });

    auto size = counts.at(0).size;
    topNumbers.clear();
    top2Count = Top2Count{0, 0};

    size_t index = 0;
    for(const auto& count : counts) {
        if (index == 0) {
            if (size == count.size) {
                topNumbers.push_back(count.number);
                top2Count.first = size;
            } else {
                index = 1;
                size = count.size;
            }
        }

        if (index >= 1) {
            if (count.size == size) {
                top2Count.second = size;
            } else {
                break;
            }
        }
    }

    return;
}

int main(int argc, char* argv[]) {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);

    size_t size = 0;
    std::string paramLine;
    std::getline(std::cin, paramLine);
    std::istringstream isp(paramLine);
    isp >> size;

    std::string numLine;
    std::getline(std::cin, numLine);
    std::istringstream is(numLine);

    NumberCount occurenceA;
    NumberCount occurenceB;
    size_t i = 0;
    while(i < size) {
        Number n = 0;
        is >> n;
        occurenceA[n] += 1;
        ++i;
        is >> n;
        occurenceB[n] += 1;
        ++i;
    }

    NumberSet topNumbersA;
    NumberSet topNumbersB;
    Top2Count top2CountA;
    Top2Count top2CountB;
    findTop2(occurenceA, topNumbersA, top2CountA);
    findTop2(occurenceB, topNumbersB, top2CountB);

    size_t answer = 0;
    if ((topNumbersA.size() > 1) || (topNumbersB.size() > 1) ||
        (topNumbersA.at(0) != topNumbersB.at(0))) {
        answer = size - top2CountA.first - top2CountB.first;
    } else {
        answer = size - std::max(top2CountA.first + top2CountB.second, top2CountB.first + top2CountA.second);
    }

    std::cout << answer << "\n";
    return 0;
}


Measured memory_bytes: 7696
#include<bits/stdc++.h>                                                                              
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
 
#define pb push_back
#define PII pair<int,int>
 
#define VS vector<string>
#define VI vector<int>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {
  int a, b, x;
  cin >> a >> b >> x;
  if (b >= x - a && a <= x) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

const int MAX_N = 200000;
int n;
ll a[MAX_N], b[MAX_N];

int main(){
  cin >> n;
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];

  ll moda[n], modb[n];
  ll ans = 0;

  REP(k, 29) {
    REP(i, n) {
      moda[i] = a[i] % (2 << k);
      modb[i] = b[i] % (2 << k);
    }
    sort(modb, modb + n);

    ll num_1 = 0;
    REP(i, n) {
      num_1 += ((lower_bound(modb, modb + n, 2 * (1 << k) - moda[i] ) - lower_bound(modb, modb + n, (1 << k) - moda[i])) + (lower_bound(modb, modb + n, 4 * (1 << k) - moda[i] ) - lower_bound(modb, modb + n, 3 * (1 << k) - moda[i]))) % 2;
    }
    ans += num_1 % 2 * (1 << k);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6528
//
// Created by kash on 16/05/20.
//

#include <bits/stdc++.h>

using namespace std;
#define mod 1e9+7
#define ll long long
#define rev_rep(it, last, first) for(int it=last-1;it>=first;--it)
#define out(x) cout << x;
#define pln(x) cout << x << "\n";
#define debug(x) cout << "Debug: " << x << "\n";
#define in(x) cin >> x;
#define rep(it, start, end) for(int it=start;it<end;++it)
#define x first
#define y second


void set_io(int inp) {
#ifndef ONLINE_JUDGE
    string folder = string(getenv("HOME")) + "/CLionProjects/CompetitiveProgramming/inputs/";
    string input_file = folder + "input-" + to_string(inp) + ".txt";
    string output_file = folder + "output-" + to_string(inp) + ".txt";
    freopen(input_file.c_str(), "r", stdin);
    freopen(output_file.c_str(), "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

}


int main() {
    set_io(1);
    int n;
    in(n);
    int rem = ((n+1000-1)/1000)*1000;
    out(rem-n);


    return 0;
}


Measured memory_bytes: 3608
N = int(input())

A = list(map(int, input().split()))
d = {}
ans = sum(A)
for a in A:
    if a in d:
        d[a]+=1
    else:
        d[a]=1




Q = int(input())

BC = []

for i in range(Q):
    b, c = map(int, input().split())
    BC.append((b,c))

for b, c in BC:
    if b in d:
        ans += (c-b)*d[b]
        tmp = d[b]
        d[b] = 0
        if c in d:
            d[c] += tmp
        else:
            d[c] = tmp
    print(ans)




Measured memory_bytes: 92656
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)
#define endl '\n'

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;


int main(){
	fast_io; cout_precision;
	double n;	cin >> n;
  cout<<ceil(n/2)/n;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int prime_numbers(int k);
int main(){
    int a,i,k,t=0;
    scanf("%d",&a);
    for(i=0;i<a;i++){
        scanf("%d",&k);
        t+=prime_numbers(k);
    }
    printf("%d\n",t);
    return 0;
}
int prime_numbers(int k){
    int i;
    if(k==1)
    return 0;
    else if(k==2) return 1;
    else{
    for(i=2;i*i<=k;i++){
        if(k%i==0)
        return 0;
    }
    return 1;
    }
}



Measured memory_bytes: 2048
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int y1 = sc.nextInt();
    int x2 = sc.nextInt();
    int y2 = sc.nextInt();
    int x3 = x2 - (y2 - y1);
    int y3 = y2 + (x2 - x1);
    int x4 = x3 - (x2 - x1);
    int y4 = y3 - (y2 - y1);

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


Measured memory_bytes: 23380
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    // https://atcoder.jp/contests/abc088/tasks/abc088_b
    class Abc_088_B
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // 整数配列の入力
            var inputIntArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();


            Array.Sort(inputIntArray);
            Array.Reverse(inputIntArray);

            int alice = 0;
            int bob = 0;

            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                {
                    alice += inputIntArray[i];
                }
                else
                {
                    bob += inputIntArray[i];
                }
            }

            int result = Math.Abs(alice - bob);

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
n = input()
x = list(n)
length = len(x)
if x[length-1] == "3":
    print("bon")
elif x[length-1] == "0" or x[length-1] == "1" or x[length-1] == "6" or x[length-1] =="8":
    print("pon")
else:
    print("hon")

Measured memory_bytes: 9016
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');
            int A, B, C;
            A = int.Parse(lines[0]);
            B = int.Parse(lines[1]);
            C = int.Parse(lines[2]);
            Console.WriteLine(C >= A && C <= B ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
void quicksort(char a[],int s,int t){
  if(s<t){
    int i=s,j=t;
    char p=a[(s+t)/2];
    while(1){
      while(a[i]<p)i++;
      while(p<a[j])j--;
      if(i>=j)break;
      a[i]^=a[j]^=a[i]^=a[j];
      i++;j--;
    }
    quicksort(a,s,i-1);quicksort(a,j+1,t);
  }
}

int main(){
  char s[101],t[101];
  int i,x,y;
  scanf("%s%s",s,t);
  for(x=0;s[x];x++);for(y=0;t[y];y++);
  quicksort(s,0,x-1);quicksort(t,0,y-1);
  for(i=0;i<y/2;i++)t[i]^=t[y-i-1]^=t[i]^=t[y-i-1];
  for(i=0;i<y;i++){if(s[i]<t[i]){printf("Yes");return 0;}if(s[i]>t[i]){printf("No");return 0;}}
  printf("No");
}


Measured memory_bytes: 1724
#初期値として、全ての要素が異なるグループ(要素番号＝グループ番号)
#に属するようにする。全ての要素が木の根になる。
class UnionFind():
    def __init__(self,n):
        self.par=[i for i in range(n+1)]
        self.rank=[0 for _ in range(n+1)]
        self.size=[1 for _ in range(n+1)]


#再帰的に木の根を求めることで、ある要素が属するグループを探索する。
    def find(self,x):
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            return self.find(self.par[x])

#2つの要素が属するグループを結合する。xの子ノードとしてyを連結する。
    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x!=y:
            if self.rank[x]<self.rank[y]:
                x,y=y,x
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1
            self.par[y]=x
            self.size[x]+=self.size[y]

#2つの要素が同じグループに属するか否かは、findを用いると簡単に求まる。
    def is_same(self,x,y):
        return self.find(x)==self.find(y)

#xが属するグループの要素数    
    def get_size(self,x):
        x=self.find(x)
        return self.size[x]

n,k,l=map(int,input().split())
uf1=UnionFind(n)
uf2=UnionFind(n)
for _ in range(k):
    p,q=map(int,input().split())
    uf1.union(p,q)

for _ in range(l):
    r,s=map(int,input().split())
    uf2.union(r,s)

#道路と鉄道の連結の組み合わせ(根のペアのカウント)
from collections import defaultdict
c=defaultdict(int)
for i in range(1,n+1):
    c[(uf1.find(i),uf2.find(i))]+=1
    #print(c[(uf1.find(i),uf2.find(i))])
for i in range(1,n+1):
    print(c[(uf1.find(i),uf2.find(i))])

Measured memory_bytes: 59036
n=int(input())
a=input()
if n!=1:
  b=input()
  m=[]
  if len(a)>len(b):
    a,b=b,a
  b=list(b)
  for i in a:
    for j in range(len(b)):
      if i==b[j]:
        m.append(i)
        b[j]=''
        break
  for _ in range(n-2):
    s=list(input())
    l=[]
    for i in m:
      for j in range(len(s)):
        if i==s[j]:
          l.append(i)
          s[j]=''
          break
    m=l
  print(''.join(sorted(m)))  
else:
  print(''.join(sorted(a)))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdbool.h> 

bool judge(int x, int y, int z)
{    
    bool flag = false;
    if (x * x + y * y == z * z){
        flag = true;
    } else if (y * y + z * z == x * x){
        flag = true;
    } else if (z * z + x * x == y * y){
        flag = true;
    }
    return flag;
}


int main(void)
{
    int repeat, a, b, c;
    scanf("%d", &repeat);
    for (int i = 0; i < repeat ; ++i){
        scanf("%d %d %d", &a, &b, &c); 
        bool flag = judge (a, b, c); 
        if (flag == true){    
            printf("YES\n");
        } else {	
            printf("NO\n");
        }
    }
    return 0;        
}

Measured memory_bytes: 1008
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll a[100000+10];
ll ans[100000+10];

int main(){
int n, j;
cin >> n >> j;
for(int i=0; i<n; i++){
cin >> a[i];
ans[i] = INT_MAX;
}
ans[0]=0;
ans[1] = abs(a[1]-a[0]);
for(int i=2; i<n; i++){
        for(int h=i-1, k=0; h>=0 && k<j; k++, h--)
    {
        ans[i] = min(ans[i],ans[h]+abs(a[i]-a[h]));
    }
}
cout << ans[n-1];
return 0;
}


Measured memory_bytes: 5188
#include<cstdio>
#include<iostream>
#include<memory.h>
using namespace std;
bool vis[200005];
bool vis1[200005];
int a[200005];
int main()
{
    memset(vis,0,sizeof(vis));
    memset(vis1,0,sizeof(vis1));
    int n,m;
    scanf("%d%d",&n,&m);
    int j=0;
    for(int i=0;i<m;i++)
    {
        int b;
        scanf("%d",&b);
        vis[b]=1;
        a[j++]=b;
    }
    while(j--)
    {
        if(vis1[a[j]]==0)
        {
            printf("%d\n",a[j]);
            vis1[a[j]]=1;
        }
    } 
    for(int i=1;i<=n;i++)
    {
        if(vis[i]==0) 
        printf("%d\n",i);
    }
    return 0;
} 

Measured memory_bytes: 4004
#abc090d

n,k=map(int,raw_input().split())
res=0
for b in xrange(1,n+1):
 x=n/b
 r=n%b
 res+=x*max(0,b-k)
 res+=max(0,r-k+1)
if k==0:
 res=n**2
print res


Measured memory_bytes: 2568
#include <iostream>    // cin, cout
#include <string>    // string, stoi, to_string
#include <algorithm>    // sort, lower_bound, heap, min, next_permutation 
#include <functional>    // greater, less
#include <vector>    // vector
#include <stack>    // stack
#include <queue>    // queue
#include <list>    // list
#include <map>    // map
#include <set>    // set
#include <tuple>    // tuple
#include <bitset>    // bitset
#include <cstdio>  // fopen, printf, scanf, puts
#include <cmath>    // sin, exp, log, pow, sqrt
#include <iomanip>    // setfill, setbase
#include <ctime>    // clock

using namespace std;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30));
const long long linf = (1LL<<60);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if(a == 0) cout << 1 << endl;
    else if(b == 0) cout << 2 << endl;
    else if(c == 0) cout << 3 << endl;
    else if(d == 0) cout << 4 << endl;
    else cout << 5 << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

struct Edge{
  int to;
  int cost;
};
const int MAX = 101010;

vint dist(MAX,-1);
vbool used(MAX,false);
vector<vector<Edge>> E(MAX);

void dfs(int n,int cost,vbool &used,vint &dist,int oya,bool &ok){
  if(used[n]){
    if(dist[n] != cost) ok = false;
  }
  else{
    used[n] = true;
    dist[n] = cost;
    for(auto p:E[n]){
      if(p.to != oya) dfs(p.to,cost+p.cost,used,dist,n,ok);
    }
  }
}

signed main(){
  int n,m;
  cin >> n >> m;
  rep(i,m){
    int l,r,d;
    cin >> l >> r >> d;
    l--;r--;
    E[l].push_back(Edge{r,d});
    E[r].push_back(Edge{l,-d});
  }
  bool ok = true;
  rep(i,n){
    if(!used[i]){
      dfs(i,0,used,dist,-1,ok);
      if(!ok){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 18432
"""
重さと価値がそれぞれw_i,v_iであるようなn個の品物がある.
これらの品物の中から, 重さの総和がWを超えないように選んだ時の,
価値の総和の最大値を求めよ.
1<=n<=100, 1<=w_i,v_i<=100, 1<=W<=10000
"""
#-------------------------------------------------------------------------------
n ,W = map(int, input().split())
w=[0]*n
v=[0]*n
for i in range(n):
    x,y = map(int, input().split())
    w[i] = x
    v[i] = y
dp = [[0 for i in range(W+1)] for j in range(n+1)]
for i in range(n):
    for j in range(W+1):
        if j < w[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i])
#print(dp)
print(dp[n][W])


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

#define   ll     long long int

int cnt[28];
int cur[28];

int main( )
{
    string con[55];
    string s;
    int i, j, k, n;
    cin >> n;
    for (i = 1; i <= n; i++) {
        cin >> con[i];
    }
    for (i = 0; i < (int) con[1].size(); i++) {
        cnt[con[1][i] - 'a']++;
    }
    for (i = 2; i <= n; i++) {
        memset(cur, 0, sizeof cur);
        for (j = 0; j < (int) con[i].size(); j++) {
            int x = con[i][j] - 'a';
            cur[x]++;
        }
        for (int i = 0; i < 26; i++) {
            cnt[i] = min(cnt[i], cur[i]);
        }
    }
    s = "";
    for (i = 0; i < 26; i++) {
        for (j = 0; j < cnt[i]; j++) {
            s.push_back(char(i + 'a'));
        }
    }
    cout << s << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define LOOP_INIT 0
#define TESTCASE_ARRAY_MAX 100
#define EXIT_SUCCESS 0
#define PREV_ITEM( x ) x - 1

int main( void )
{
	unsigned char aubW_Dtestcase[ TESTCASE_ARRAY_MAX ];
	unsigned char ubW_Dtc_cnt;
	unsigned char ubW_Dtc_min;
	unsigned char ubW_Dtrade;
	unsigned char ubW_Carray_cnt;
	unsigned char ubW_Carray_sub_cnt;
	unsigned short usW_Csort_cnt;

	scanf( "%d", &ubW_Dtc_cnt );
	for( ubW_Carray_cnt = LOOP_INIT; ubW_Carray_cnt < ubW_Dtc_cnt; ubW_Carray_cnt++){
		scanf( "%d", &aubW_Dtestcase[ ubW_Carray_cnt ] );
	}

	for( ubW_Carray_cnt = LOOP_INIT; ubW_Carray_cnt < ubW_Dtc_cnt; ubW_Carray_cnt++ ){
		ubW_Dtc_min = ubW_Carray_cnt;
		for( ubW_Carray_sub_cnt = ubW_Carray_cnt; ubW_Carray_sub_cnt < ubW_Dtc_cnt; ubW_Carray_sub_cnt++){
			if( aubW_Dtestcase[ ubW_Carray_sub_cnt ] < aubW_Dtestcase[ ubW_Dtc_min ] ){
				ubW_Dtc_min = ubW_Carray_sub_cnt;
			}
			else{
				/* else?????????????????????????????\ */
			}
		}
		if( aubW_Dtestcase[ ubW_Carray_cnt ] > aubW_Dtestcase[ ubW_Dtc_min ] ){
			ubW_Dtrade = aubW_Dtestcase[ ubW_Carray_cnt ];
			aubW_Dtestcase[ ubW_Carray_cnt ] = aubW_Dtestcase[ ubW_Dtc_min ];
			aubW_Dtestcase[ ubW_Dtc_min ] = ubW_Dtrade;
			usW_Csort_cnt++;
		}
		else{
			/* else?????????????????????????????\ */
		}
	}

	for( ubW_Carray_cnt = LOOP_INIT; ubW_Carray_cnt < PREV_ITEM( ubW_Dtc_cnt ); ubW_Carray_cnt++ ){
		printf( "%d ", aubW_Dtestcase[ ubW_Carray_cnt ] );
	}
	printf( "%d\n", aubW_Dtestcase[ PREV_ITEM( ubW_Dtc_cnt ) ] );
	printf( "%d\n", usW_Csort_cnt );

	return EXIT_SUCCESS;
}

Measured memory_bytes: 600
#include<stdio.h>
int main(void){
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if (x - r < 0 || y - r < 0){
		printf("No\n");
	}
	else if (x + r>W || y + r > H){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
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);
}
int main()
{
    string s, t, ss;
    cin >> s >> t;
    ss = s + s;
    ll n = s.size(), m = t.size();
    set<int> pos[26];
    for (int i = 0; i < n; i++)
    {
        for (char c = 'a'; c <= 'z'; c++)
        {
            if (s[i] == c)
                pos[c-'a'].insert(i+1);
        }
    }
    bool ok = true;
    for (size_t i = 0; i < m; i++)
    {
        if (pos[t[i]-'a'].empty())
        {
            cout << -1;
            return 0;
        }
    }
    ll ans = 0;
    ll now = 0;
    for (size_t i = 0; i < m; i++)
    {
        char c = t[i]-'a';
        if (now >= *(--pos[c].end()))
        {
            ans += n - now;
            now = 0;
        }
        auto newpos=*pos[c].lower_bound(now+1);
        ans += newpos - now;
        now = newpos;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 5328
#include<stdio.h>
#include<math.h>

void ans(int *a) 
{
	if (*a == 1) {
		printf("YES\n");
	}
	else if (*a == 0) {
		printf("NO\n");
	}
}

int main(void)
{
	int n;
	int i;
	int a, b, c, x;
	int result[1000];
	
	for (i = 0; i < 1000; i++) {
		result[i] = 0;
	}
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) {
		scanf("%d %d %d", &a, &b, &c);
		
		if (a < b) {
			x = a;
			a = b;
			b = x;
		}
		
		if (b < c) {
			x = b;
			b = c;
			c = x;
		}
		
		if (a < b) {
			x = a;
			a = b;
			b = x;
		}
		
		if (a * a == b * b + c * c) {
			result[i]++;
		}
		
	}
	
	for (i = 0; i < n; i++) {
		ans(&result[i]);
	}
	
	return (0);
}

Measured memory_bytes: 1012
import java.util.*;

public class Main {
	
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] arr = new String[3];
		int[] idxes = new int[3];
		for (int i = 0; i < 3; i++) {
			arr[i] = sc.next();
		}
		int idx = 0;
		while (true) {
			if (idxes[idx] >= arr[idx].length()) {
				System.out.println((char)('A' + idx));
				break;
			}
			int i = idxes[idx];
			idxes[idx]++;
			idx = arr[idx].charAt(i) - 'a';
		}
	}
}


Measured memory_bytes: 21972
#include "bits/stdc++.h"
using namespace std;
typedef unsigned long long ll;
vector<ll > vec;
vector<vector<ll > > vec2;

ll sum(ll a, ll b){
    ll ans = 0;
    for(ll i = a; i <= b; i++){
        ans+=i;
    }
    return ans;
}

int main(){

    string s;
    cin >> s;
    
    for(ll i = 0; i < s.length();){
        ll j = i;
        //一緒の間ループを回し続けて，切れ目を探す
        while(j < s.length() && s[j] == s[i]){
            ++j;
        }
        vec.push_back(j - i);
        //次の始点へすっ飛ばす
        i = j;
    }

    ll ans = 0;
    ll idx = 0;

    if(s[0] == '>'){
        ans += sum(0, vec[0]);
        idx = 1;
    }

    if((vec.size() + idx) % 2 != 0){
        vec.push_back(1);
    }
    for(ll i = 1 + idx; i < vec.size(); i+=2){
        if(vec[i] >= vec[i-1]){
            ans += sum(0, vec[i-1]-1);            
            ans += sum(0 , vec[i]);
        }else{
            ans += sum(0, vec[i-1]);
            ans += sum(0, vec[i] - 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3068
n = input().strip()
n = int(n)
i = list(map(int, input().split()))
ans = 0
for a in range(n):
    if a == 0:
        pass
    elif a == n-1:
        pass
    else:
        if i[a-1] > i[a] and i[a] > i[a+1] or i[a-1]<i[a] and i[a]< i[a+1]:
            ans += 1
        if i[a-1] == i[a] and i[a] > i[a+1] or i[a+1] == i[a] and i[a] > i[a-1]:
            ans += 1
        else:
            pass
print(ans)


Measured memory_bytes: 3064
import java.util.*;

class Main{
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    String ans = "Yes";
    if (A == B && B==C){
      ans = "No"; 
    }else if (A != B && B!= C && C != A){
      ans = "No"; 
    }
    System.out.println(ans);
  }
}

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

int a[3];

int main(){
    int count5=0;
    int count7=0;
    for(int i=0;i<3;i++){
        cin>>a[i];
        if(a[i]==5)count5++;
        if(a[i]==7)count7++;
    }
    if(count5==2&&count7==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    kas = [list(map(int, input().split())) for _ in range(n)]
    question_dict = {i: 0 for i in range(1, m+1)}
    ans = 0

    for ka in kas:
        a = ka[1:]
        for i in a:
            question_dict[i] += 1

    for food, num in question_dict.items():
        if num == n:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

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

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int L, R, d;
  cin >> L >> R >> d;
  int ret = 0;
  for(int i = L; i <= R; i++) {
    if(i % d == 0) ++ret;
  }
  cout << ret << "\n";
}

Measured memory_bytes: 3600
import math

A, B, H, M = map(int, input().split())

short_v = 360 / (12*60)
long_v = 360 / 60

short_arg = (short_v * (H * 60) + short_v * M)
long_arg = long_v * M

theta = math.radians(abs(short_arg-long_arg))

result_2 = A**2 + B**2 - 2*A*B*math.cos(theta)

print(math.sqrt(result_2))


Measured memory_bytes: 62576
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
          
       	var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long M = inputArray[1];

			var aList = retreiveLongArray().OrderBy(x => x).ToList();

			var inpDic = new Dictionary<long, long>();//変更先:変えられる枚数
			checked {

			for (int i = 0; i < M; i++) {
				var inp = retreiveLongArray();
				if (inpDic.ContainsKey(inp[1])) {
					inpDic[inp[1]] += inp[0];
				}
				else {
					inpDic.Add(inp[1], inp[0]);
				}
			}

			var koujunC = inpDic.OrderByDescending(x => x.Key).Select(x => x.Key).ToArray();
			var koujunClength = koujunC.Length;
			var j = 0;
			var Cj = koujunC[j];
			for (int i = 0; i < N; i++) {
				var a = aList[i];
				if (a >= Cj) {
					break;
				}
				aList[i] = Cj;
				inpDic[Cj]--;
				//その数を変え終わったとき
				if (inpDic[Cj] == 0) {
					j++;
					if (j == koujunClength) {//すべてのカード変更権利を使い切ったとき
						break;
					}
					Cj = koujunC[j];
				}

			}


			//答えの出力
			var ans = aList.Sum();
			Console.WriteLine(ans);
			}
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

Measured memory_bytes: 36284
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    long long x; std::cin >> x;
    for (long long i = -120; i <= 120; i++) {
        for (long long j = -120; j <= 120; j++) {
            if (i*i*i*i*i - j*j*j*j*j == x) {
                std::cout << i << " " << j << std::endl;
                return 0;
            }
        }
    }
    return 0;
}


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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N, K;
    cin >> N >> K;
    vector<unsigned long> coef(N);
    {
        vector<unsigned long> tap(N - K + 1);
        tap[0] = 1;
        tap[1] = 1;
        for(unsigned long i{2}; i < N - K + 1; ++i)tap[i] = tap[MOD % i] * (MOD - MOD / i) % MOD;
        for(unsigned long i{1}; i < N - K + 1; ++i)(tap[i] *= K + i - 1) %= MOD;
        for(unsigned long i{1}; i < N - K + 1; ++i)(tap[i] *= tap[i - 1]) %= MOD;
        reverse(tap.begin(), tap.end());
        for(unsigned long i{0}; i < N - K + 1; ++i)coef[i] = MOD - tap[i];
        for(unsigned long i{0}; i < N - K + 1; ++i)(coef[N - i - 1] += tap[i]) %= MOD;
    }
    vector<unsigned long> A(N);
    {
        vector<long> a(N);
        copy_n(istream_iterator<long>(cin), N, a.begin());
        sort(a.begin(), a.end());
        transform(a.begin(), a.end(), A.begin(), [](auto i){return ((i % static_cast<long>(MOD)) + MOD) % MOD;});
    }
    cout << inner_product(coef.begin(), coef.end(), A.begin(), 0UL, [](auto i, auto j){return (i + j) % MOD;}, [](auto i, auto j){return (i * j) % MOD;}) << endl;
    return 0;
}

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

int main() {
  vector<long long> NM(2);
  cin >> NM.at(0) >> NM.at(1);
  sort(NM.begin(), NM.end());
  if (NM.at(0) == 1 && NM.at(1) == 1) cout << 1 << endl;
  else if (NM.at(0) == 1 && NM.at(1) != 1) cout << NM.at(1) - 2 << endl;
  else cout << (NM.at(0) - 2) * (NM.at(1) -2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

const int N = 1e5 + 2;

int n, k, w[101], v[101];
long long dp[101][N];

long long calc(int i, int rem)
{
    if (i == n)
    {
        return 0;
    }
    long long &ret = dp[i][rem];
    if (ret != -1)
    {
        return ret;
    }
    ret = calc(i + 1, rem);
    if (rem >= w[i])
    {
        ret = max(ret, calc(i + 1, rem - w[i]) + v[i]);
    }
    return ret;
}

int main()
{
    memset(dp, -1, sizeof dp);
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
    {
        cin >> w[i] >> v[i];
    }
    cout << calc(0, k) << endl;
    return 0;
}

Measured memory_bytes: 79232
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[][] s = new int[n][26];

    for (int i = 0; i < n; i++) {
      String s_ = sc.next();
      for (int j = 0; j < s_.length(); j++) {
        s[i][(int) s_.charAt(j) - 97]++;
      }
    }

    sc.close();

    for (int i = 0; i < 26; i++) {
      int min = 100;
      for (int j = 0; j < n; j++) {
        min = Math.min(min, s[j][i]);
      }
      for (int k = 0; k < min; k++) {
        System.out.print(String.valueOf((char) (i+97)));
      }
    }

    System.out.println("");

  }

}

Measured memory_bytes: 21588
#include <stdio.h>
#include <math.h>
 
int main(void)
{
	int a, b;
	char op;
	while(scanf("%d %c %d", &a, &op, &b))
	{
		if(op == '?')
		{
			break;
		}
		switch(op)
		{
			case '+':
			printf("%d\n", a + b);
			break;
		
		
			case '-':
			printf("%d\n", a - b);
			break;
		
		
			case '*':
			printf("%d\n", a * b);
			break;
		
		
			case '/':
			printf("%d\n", a / b);
			break;
		}
		
		
	}
}


Measured memory_bytes: 2688
#include <iostream>
#include <cstdio>
#include <vector>
#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()
{
    string s;
    cin >> s;

    int flag = 1;
    if (s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]);
    else if (s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]);
    else if (s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]);
    else flag = 0;

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}




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

Measured memory_bytes: 256
"""
一回以上わるとき、KはNの約数なので、Nの約数を全通り試して1に持っていけるかどうかを検証する。
Nを一回も割らずに1まで持っていけるようなKは、N-1の約数の数だけ存在する。
それぞれカウントすればよい
"""
N = int(input())
ans = 0
if N == 2:
    print(1)
    exit()

divisers = [N]
d = 2
while d*d < N:
    if N % d == 0:
        divisers.append(d)
        divisers.append(N//d)
    d += 1
if d**2 == N:
    divisers.append(d)

for d in divisers:
    dummyN = N
    while dummyN%d == 0:
        dummyN //= d
    if dummyN % d == 1:
        ans += 1

N -= 1
divisers = [N]
d = 2
while d*d < N:
    if N % d == 0:
        divisers.append(d)
        divisers.append(N//d)
    d += 1
if d**2 == N:
    divisers.append(d)

ans += len(divisers)

print(ans)

Measured memory_bytes: 66308
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int v[] = new int[5];
    for (int i = 0; i < 5; i++) v[i] = sc.nextInt();
    int k = sc.nextInt();
    System.out.println((v[4] - v[0] <= k) ? "Yay!" : ":(");
  }
}

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

using namespace std;

typedef long long ll;

int main() {
  int n; cin >> n;
  vector <ll> a(n + 1), b(n);
  for(int i = 0; i < n + 1; i++) {
    cin >> a[i];
  }
  for(int i = 0; i < n; i++) {
    cin >> b[i];
  }
  ll ans = 0;
  for(int i = 0; i < n; i++) {
    if(b[i] >= a[i]) {
      ans += a[i];
      b[i] -= a[i];
      a[i] = 0;
    }
    else if(b[i] < a[i]) {
      ans += b[i];
      a[i] -= b[i];
      b[i] = 0;
    }
    if(b[i] >= a[i + 1]) {
      ans += a[i + 1];
      b[i] -= a[i + 1];
      a[i + 1] = 0;
    }
    else if(b[i] < a[i + 1]) {
      ans += b[i];
      a[i + 1] -= b[i];
      b[i] = 0;
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 1792
#include<cstdio>
#include<vector>
struct Pair{
    int x,y;
    Pair(int x,int y):x(x), y(y){}
};
std::vector<Pair>keep[20000];
int vis[40];
int pair[20][2]; int size = -1;
char s[20][20];
int cnt[20][27];
int edge[20][20];

void preWork(int n,int m){
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 26; j++) cnt[i][j] = 0;
        for(int j = 1; j <= m; j++) cnt[i][s[i][j]-'a']++;
    }
}

void dfs(int p,int n){
    if(p!=n+1){
        int find = -1;
        for(int i = 1; i <= 2*n; i++){
            if(!vis[i]){
                find = i;
                break;
            }
        }
        vis[find] = 1;
        for(int i = 1; i <= 2*n; i++){
            if(!vis[i]){
                vis[i] = 1;
                pair[p][0] = find, pair[p][1] = i;
                dfs(p+1,n);
                vis[i] = 0;
            }
        }
        vis[find] = 0;
    }
    else{
        size++;
        for(int i = 1; i <= n; i++){
            keep[size].push_back(Pair(pair[i][0],pair[i][1]));
        }
    }
}

int min(int a,int b){ return a>b?b:a; }

int getEdge(std::vector<Pair>&pairs,int n,int m){
    for(int i = 1; i <= m; i++){
        for(int j = i; j <= m; j++){
            edge[i][j] = edge[j][i] = 1;
        }
    }
    for(Pair &p: pairs){
        int x = p.x, y = p.y;
        if(x>n || y>n) x = min(p.x,p.y), y = min(p.x,p.y);
        //printf("x = %d, y = %d\n",x,y);
        for(int i = 0; i < 26; i++) if(cnt[x][i]!=cnt[y][i]) return 0;
        for(int i = 1; i <= m; i++){
            for(int j = i+1; j <= m; j++){
                if(s[x][i]==s[y][j] && s[x][j]==s[y][i]){}
                else{ 
                    //printf("i = %d, j = %d\n",i,j);
                    edge[i][j] = edge[j][i] = 0;
                }
            }
        }
    }
    return 1;
}

int findAns = -1;

void dfs1(int p,int n){
    if(p!=n+1){
        int find = -1;
        for(int i = 1; i <= 2*n; i++){
            if(!vis[i]){
                find = i;
                break;
            }
        }
        vis[find] = 1;
        for(int i = 1; i <= 2*n; i++){
            if(!vis[i] && edge[find][i]){
                //printf("find = %d, i = %d\n",find,i);
                vis[i] = 1;
                dfs1(p+1,n);
                vis[i] = 0;
            }
        }
        vis[find] = 0;
    }
    else findAns = 1;
}

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 1; i <= n; i++){
        scanf("%s",s[i]+1);
    }
    preWork(n,m);
    size = 0;
    dfs(1,(n+1)/2);
    //printf("ok, size = %d\n",size);
    int good = 0;
    for(int i = 1; i <= size; i++){
        //printf("i = %d, len = %d\n",i,keep[i].size());
        //for(Pair &p: keep[i]) printf("x = %d, y = %d\n",p.x,p.y);
        if(getEdge(keep[i],n,m)){
            //printf("ok\n");
            if(m%2) for(int j = 1; j <= m; j++) edge[j][m+1] = edge[m+1][j] = 1;
            findAns = 0;
            dfs1(1,(m+1)/2);
            if(findAns==1){
                good = 1;
                break;
            }
        }
    }
    if(good) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 4472
K, N = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
M = 0
for i in range(N-1):
  t = l[i+1] - l[i]
  M = max(M, t)
t = K - l[-1] + l[0]
M = max(M, t)
print(K - M)

Measured memory_bytes: 24908
#include<iostream>
using namespace std;
int a,b,c,k;
int main(void){
	cin>>a>>b>>c;
	k=max(a,b);k=max(k,c);k=k-a+k-b+k-c;
	if(k%2==0)cout<<k/2;
	else cout<<(k+3)/2;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc060/tasks/abc060_b

int main() {
    int A, B, C; cin >> A >> B >> C;

    for (int i = 1; i <= B; i++) if (A*i%B==C){
            cout << "YES" << "\n";
            return 0;
    }

    cout << "NO" << "\n";
    return 0;
}


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;

int main(){
    string S, T;
    cin >> S >> T;
    int len = S.length();
    int cnt = 0;

    rep(i, len){
        if (S[i] != T[i]){
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3848
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  string s;
  cin >> s;

  bool isok = true;
  for(int i=0;i<s.size();i++){
    if(i==a){
      if(s[i] != '-') isok = false;
    } else {
      if(s[i] == '-') isok = false;
    }
  }

  if(isok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
int n,i,r,l;long ans=0;
scanf("%d%d%d",&n,&l,&r);
for(i=1;i<=n;i++){
int ketawa=0,a=i;
while(a>0){
ketawa+=a%10;
a=(a-a%10)/10;
}
if(ketawa>=l&&ketawa<=r)ans+=i;
}
printf("%ld\n",ans);
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q; cin >> q;
    const int N = 101010;
    V<int> erast(N, 1); erast[0] = erast[1] = 0;
    for (int i = 2; i < N; i++) {
        if (erast[i] == 1) {
            for (int j = 2 * i; j < N; j += i) {
                erast[j] = 0;
            }
        }
    }

    V<int> acc(N, 0);
    for (int i = 1; i < N; i += 2) {
        if (erast[i] & erast[(i + 1) / 2]) acc[i] = 1;
    }
    for (int i = 1; i < N; i++) acc[i] += acc[i - 1];

    for (int i = 0; i < q; i++) {
        int l, r; cin >> l >> r;
        cout << acc[r] - acc[l - 1] << '\n';
    }
    return 0;
}


Measured memory_bytes: 1408
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a == b) printf("Draw\n");
    else if (a == 1) printf("Alice\n");
    else if (b == 1) printf("Bob\n");
    else if (a > b) printf("Alice\n");
    else printf("Bob\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 1000000000
#define MOD 1000000007
#define ll long long int

using namespace std;

int main(){
  int N; cin>>N;
  vector <int> w(N); 
  ll sum = 0;
  for(int i=0;i<N;i++) {cin>>w[i]; sum += w[i];}

  ll now = 0;
  ll ans = INF;

  for(int i=0;i<N;i++){
    now += w[i];
    ans = min(ans,abs(sum - now - now));
  }

  cout<<ans<<endl;

  return 0;

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int n, ans = 0;
	cin >> n;
	if(n % 10 == 0){
		ans = 10;
	}else{
		int t = n;
		while(t > 0){
			ans += t % 10;
			t /= 10;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a=new int[3];
        for(int i=0;i<3;i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);
    }
}



Measured memory_bytes: 26344
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = LIST()
print("A" + S[1][0] + "C")

Measured memory_bytes: 5144
import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

@safe
long solve (const string s) {
  enum m = 2019;
  auto c = new int[m];
  auto d = new int[m];
  long res;
  foreach (ch; s) {
    c[0] += 1;
    const int k = ch.to!int - 48;
    d[] = 0;
    int v = k;
    foreach (j; 0 .. m) {
      d[v] += c[j];
      v += 10;
      if (v >= m) v -= m;
    }
    swap (c, d);
    res += c[0];
  }
  return res;
}

void main() {
  auto s = readln.stripRight;
  writeln (solve (s));
}



Measured memory_bytes: 3328