akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void)
{
    int A[20];
    int n,i;
    int kosu=0;

    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }

    for(i=1;i<n-1;i++){
        if(A[i]<A[i-1] && A[i]>A[i+1]){
            kosu+=1;
        }
        else if(A[i]>A[i-1] && A[i]<A[i+1]){
            kosu+=1;
        }
    }

    printf("%d\n",kosu);

    return 0;
}

Measured memory_bytes: 128
using System.Linq;
using System;
class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
        bool[] colors = new bool[8];
        int others = 0;
        foreach (var rate in a)
        {
            if (rate >= 3200)
            {
                others++;
            }
            else
            {
                colors[rate / 400] = true;
            }
        }
        var min = colors.Count(x => x);
        var max = min + others;
        Console.WriteLine($"{(min > 0 ? min : 1)} {max}");
    }
}

Measured memory_bytes: 13396
import Data.Bits
import qualified Data.Vector.Unboxed as V
import Data.List
import Data.Monoid
-- import GHC.Stack (HasCallStack)

-- path1 n a b xs
--   n == length xs + 1
--   popCount (a `xor` b) == 1
path1 :: Int -> Int -> Int -> [Int] -> V.Vector Int
-- path1 n a b xs | not (n == length xs + 1) = error "path1: precondition 1"
-- path1 n a b xs | not (popCount (a `xor` b) == 1) = error "path1: precondition 2"
path1 1 a b [] = V.fromList [a,b] -- [0,2^k] popCount (a `xor` b) == 1
path1 n a b (k:ks) = let v = path1 (n - 1) a b ks
                         (v0,v1) = V.splitAt (2^(n-2)) v
                         y = 2^k
                     in v0 <> V.map (`xor` y) (V.reverse v0) <> V.map (`xor` y) (V.reverse v1) <> v1

-- pathN m a b xs availBits
pathN :: Int -> Int -> Int -> [Int] -> [Int] -> V.Vector Int
pathN m a b [i] availBits = path1 m a b availBits
pathN m a b (i0:i1:is) availBits = let a' = a `xor` bit i0
                                       b' = a' `xor` bit i1
                                   in path1 (m-1) a a' (is ++ availBits) <> pathN (m-1) b' b is (i0 : availBits)

parseInts :: String -> [Int]
parseInts s = case reads s of
                [(x,t)] -> x : parseInts t
                _ -> []

{-
myAssert :: HasCallStack => Bool -> IO ()
myAssert True = return ()
myAssert False = error "Assertion failed"
-}

main = do
  [n,a,b] <- parseInts <$> getLine
  let c = a `xor` b
  if odd (popCount c)
    then do putStrLn "YES"
            let bitsDiffer = [i | i <- [0..n-1], testBit c i]
                bitsSame = [i | i <- [0..n-1], not (testBit c i)]
            let xs = pathN n a b bitsDiffer bitsSame
                xss = V.toList xs
            putStrLn $ intercalate " " $ map show xss
            {-
            let differByOne a b = popCount (a `xor` b) == 1
            myAssert (and $ zipWith differByOne xss (tail xss))
            myAssert (a == V.head xs && b == V.last xs)
            myAssert (sort xss == [0..2^n-1])
            -}
    else putStrLn "NO"


Measured memory_bytes: 6140
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////




int main() {
	string S;ll K; cin >> S >> K;
	char ans;
	int a;
	rep(i,100)
	{
		if(S[i] != '1' ){ans =S[i]; a = i+1; break;} //a=初めて1以外の数字が出るときの番号
	}
	if(K < a){cout << 1 << endl;}
	else {cout << ans << endl;}
}

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


typedef long long ll;


int main()
{
ll n,k,i,sum=0,t=0,v=0;
cin>>n>>k;
ll h[n],min,max;

for(i=0; i<n; i++){
    cin>>h[i];
    t=t+h[i];
}
sort(h,h+n);
min=h[0];
max=h[n-1];
for(i=0; i<n; i++){
        h[n-1]=0;
      sum=sum+h[i];

}

 for(i=0; i<n-k; i++){

 v=v+h[i];
 }




if(n<=k){
 cout<<0<<endl;
   return 0;
}


else if (k==0){
  cout<<t<<endl;
  return 0;
}
else if(k==1) {
cout<<sum<<endl;
  return 0;
}
else {
 cout<<v<<endl;
}

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <stack>
using namespace std;

int main()
{
	string weather[3] = { "Sunny","Cloudy","Rainy" };
	string today;
	cin >> today;

	if (today == weather[0]) {
		cout << weather[1];
	}
	else if (today == weather[1]) {
		cout << weather[2];
	}
	else {
		cout << weather[0];
	}
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = readLine()!!
    val rud = setOf('R', 'U', 'D')
    val lud = setOf('L', 'U', 'D')
    if (s.filterIndexed { i, c -> i % 2 == 0}.all { rud.contains(it) }
        && s.filterIndexed{ i, c -> i % 2 == 1}.all { lud.contains(it) }) {
        print("Yes")
    } else {
        print("No")
    }
}


Measured memory_bytes: 35900
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        if (S.equals("ABC")) {
            System.out.println("ARC");
        } else if (S.equals("ARC")) {
            System.out.println("ABC");
        }   
    }
}

Measured memory_bytes: 35528
if __name__ == "__main__":
    a, b = list(map(lambda x: int(x), input().split()))
    c = g = 1
    e = f = 0
    while b:
        d, m = divmod(a, b)
        h = c - d * e
        i = f - d * g
        a, b = b, m
        c, e = e, h
        f, g = g, i
    print(c, f)



Measured memory_bytes: 5604
#include<stdio.h>
int a[25], n, q, x, f;

void r(int i,int sum){
    int res;
    if(sum == x) {f = 1; return;}
    if(i == n || f == 1) return;
    r(i+1, sum);
    r(i+1, sum + a[i]);
}
int main(){
    int i;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    scanf("%d", &q);
    while(q--){
        scanf("%d", &x);

        f = 0;
        r(0,0);
        printf("%s\n", f == 1?"yes": "no");
    }

    return 0;
}



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

class Program{

  static string ans = "Heisei";

  static int Main() {

    string[] nyu = Console.ReadLine().Split('/');
    int y = int.Parse(nyu[0]);
    int m = int.Parse(nyu[1]);
    int d = int.Parse(nyu[1]);

    // ここまで入力

    if (y > 2019) {
      ans = "TBD";
    } else {
      if (m > 4) {
        ans = "TBD";
      }
    }

    Console.WriteLine("{0}", ans);

    return 0;
  }

}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int g = sc.nextInt();
        int[] p = new int[d];
        int[] c = new int[d];

        for (int i = 0 ; i < d ; i++) {
            p[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int mask = 0; mask < 1 << d; mask++) {
            int sum = 0;
            int cnt = 0;
            int rest_max = -1;
            for (int i = 0; i < d ; i++) {
                if ((mask >> i & 1) == 1) {
                    sum += p[i] * (i + 1) * 100 + c[i];
                    cnt += p[i];
                } else {
                    rest_max = i;
                }
            }
            if (rest_max >= 0) {
                for (int i = 0 ; i < p[rest_max]; i++) {
                    if (sum >= g) {
                        break;
                    } else {
                        sum += (rest_max + 1) * 100;
                        cnt++;
                    }
                }
            }
            if (sum >= g) {
                ans = Math.min(cnt, ans);
            }
        }

        System.out.println(ans);
    }

}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	int xa = min(k, a);
	k = k - xa;
	int xb = min(k, b);
	k = k - xb;
	int xc = min(k, c);
	
	int result = xa - xc;
	cout << result << endl;
}

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

int main(){
    int a, b;
    string which,p;
    
    string str;
    int y;
    
    cin >> str;
    cin >> y;
    
    for(int i=0; i<y; i++){
        cin >> which >> a >> b;
        if(which=="print") cout << str.substr(a, b-a+1) << endl;
        else if(which=="replace"){
            cin >> p;
            str = str.replace(a, b-a+1, p);
        }
        else if(which== "reverse"){
            string tmp = str.substr(a, b-a+1);
            int n = tmp.size();
            for(int i=0; i< n; i++){
                str[a+i] = tmp[n-i-1];
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
int n;
int getdigit(int x)
{
	int ret=0;
	while(x)
	{
		x/=10;
		ret++;
	}
	return ret;
}
int main()
{
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++)
		if(getdigit(i)&1)
			ans++;
	cout<<ans;
	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 = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    if(Math.abs(a-c) <= d || (Math.abs(b-a) <= d && Math.abs(b-c) <= d)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21716
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author rizhiy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        long gcd(long a, long b) {
            if (b == 0) {
                return a;
            }
            return gcd(b, a % b);
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();
            long answ = (a * b) / gcd(a, b);
            if ((answ - a) % b == 0 || (answ - a) % a != 0) {
                out.println(-1);
                return;
            }
            out.println(answ - a);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 21332
//2714 加藤聖弥 問3
import java.util.Scanner;
public class Main{
    int N;
    int x;
    int y;
    int b;
    int p;
   
    
    public void solve(){
        Scanner sc=new Scanner(System.in);
            N=sc.nextInt();
        for(int s=0;s<N;s++){
            x=sc.nextInt();
            y=sc.nextInt();
            b=sc.nextInt();
            p=sc.nextInt();
            int kin=x*b+y*p;
            if(b<5){
                b=5;
            }if(p<2){
                p=2;
            }
            int war=(x*b+y*p)*8/10;
            if(kin>=war){
            System.out.println(war);
            }else{
            System.out.println(kin);
            }
        }
    }
    
    public static void main(String[] args){
        Main obj=new Main();
            obj.solve();
    }
}

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

int main() {
    string s;
    cin >> s;
    bool ans = false;
    if (s == "KIHABARA") ans = true;
    if (s == "KIHABAR") ans = true;
    if (s == "KIHABRA") ans = true;
    if (s == "KIHABR") ans = true;
    if (s == "KIHBARA") ans = true;
    if (s == "KIHBAR") ans = true;
    if (s == "KIHBRA") ans = true;
    if (s == "KIHBR") ans = true;
    if (s == "AKIHABARA") ans = true;
    if (s == "AKIHABAR") ans = true;
    if (s == "AKIHABRA") ans = true;
    if (s == "AKIHABR") ans = true;
    if (s == "AKIHBARA") ans = true;
    if (s == "AKIHBAR") ans = true;
    if (s == "AKIHBRA") ans = true;
    if (s == "AKIHBR") ans = true;
    if (ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int m = Integer.parseInt(scan.next());

		List<Integer> ac = Arrays.asList(new Integer[n]);
		List<Integer> pena = Arrays.asList(new Integer[n]);
		Collections.fill(ac, 0);
		Collections.fill(pena, 0);


		for(int i=0; i<m; ++i)  {
			int p = Integer.parseInt(scan.next());
			String s = scan.next();
			--p;
			if(ac.get(p) == 1) continue;
			if(s.equals("AC")) {
				ac.set(p, 1);
			} else {
				pena.set(p, (pena.get(p)+1));
			}
		}
		scan.close();

		int AC = 0, PENA = 0;
		for(int i=0; i<n; ++i) {
			AC += ac.get(i);
			if(ac.get(i) == 1) PENA += pena.get(i);
		}

		System.out.println(AC + " " + PENA);

	}

}

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

int main() {
  int k,a,b;
  cin >> k;
  cin >> a >> b;

  for (int i = 1; i < 1001; i++) {
    if (i % k == 0 && a <= i && i <= b) {
        cout << "OK" << endl;
        return 0;
    }
  }

  cout << "NG" << endl;

}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N],f[N];
int n,k,sum,ans;
set<int>s;
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	f[n]=1;
	for (int i=n-1;i>=1;i--) if (a[i]<a[i+1]) f[i]=f[i+1]+1; else f[i]=1;
	bool p=0;
	for (int i=1;i<=k;i++) s.insert(a[i]);
	for (int i=1;i<=n-k+1;i++) {
		if (f[i]>=k) {
			if (!p) ans++,p=1;
		} else if (i>1) {
			bool p=0;
			set<int>::iterator it;
			it=s.begin(); if (a[i-1]>(*it)) p=1;
			it=s.end(); it--;
			if (a[i+k-1]<(*it)) p=1;
			if (p) ans++;
		} else ans++;
		s.erase(a[i]); s.insert(a[i+k]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 11136
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  if(b % a == 0) {
    cout << a+b;
  } else {
    cout << b-a;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll h,n;
int main(){
    cin>>h>>n;
    vector<ll> v(n,0);
    rep(i,n) cin>>v[i];
    rep(i,n) h-=v[i];
    if(h<=0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	int a, b;
	cin >> a >> b;
	vector<int> c(3);
	while (n--) {
		int x;
		cin >> x;
		if (x <= a) {
			c[0]++;
		} else if (a < x && x <= b) {
			c[1]++;
		} else {
			c[2]++;
		}
	}
	cout << *min_element(c.begin(), c.end()) << '\n';
}


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

int main()
{
	double r;
	while(cin >> r){
		if(r <= 48.00){
			cout << "light fly" << endl;
		}else if(r <= 51.00){
			cout << "fly" << endl;
		}else if(r <= 54.00){
			cout << "bantam" << endl;
		}else if(r <= 57.00){
			cout << "feather" << endl;
		}else if(r <= 60.00){
			cout << "light" << endl;
		}else if(r <= 64.00){
			cout << "light welter" << endl;
		}else if(r <= 69.00){
			cout << "welter" << endl;
		}else if(r <= 75.00){
			cout << "light middle" << endl;
		}else if(r <= 81.00){
			cout << "middle" << endl;
		}else if(r <= 91.00){
			cout << "light heavy" << endl;
		}else{
			cout << "heavy" << endl;
		}
	}
}

Measured memory_bytes: 1220
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
 
p_list = [a, b, c, d, e]
neg_pair = False
 
for i in range(5):
  for j in range(5):
    dist = abs(p_list[i] - p_list[j])
    if dist > k:
      neg_pair = True
      break
if neg_pair:
  print(":(")
else:
  print("Yay!")

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

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    vector<int64_t> A(N), B(M), S(N + 1), T(M + 1);
    for(auto &e : A) cin >> e;
    for(auto &e : B) cin >> e;
    for(int i = 0; i < N; ++i) S[i + 1] += S[i] + A[i];
    for(int i = 0; i < M; ++i) T[i + 1] += T[i] + B[i];
    int ans = 0;
    for(int i = 0; i <= N; ++i) {
        if(S[i] > K) continue;
        int l = 0, r = M + 1;
        while(r - l > 1) {
            int c = (l + r) / 2;
            if(S[i] + T[c] <= K) l = c;
            else r = c;
        }
        ans = max(ans, i + l);
    }
    cout << ans << '\n';
    return 0;
}


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


int main(){
  int n,i,k;
  cin >> n >> k;
  int ans=0;
  vector<int> h(n);
  for(i=0;i<n;++i){
    cin >> h[i];
    if(h[i]>=k){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 640
#include<stdio.h>
int main() {
	int n, i, a[1000];
	scanf("%d", &n);
	for (i = 0;i < n;i++) {
		scanf("%d", &a[i]);
	}
	for (i = n-1;1 <= i;i--) {
		printf("%d ", a[i]);
	}
	if (i == 0) {
		printf("%d", a[0]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 604
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	ll n,m,k; cin >> n >> m >> k;
	vector<ll> a(1,0), b(1,0);
	ll ai,bi;
	ll bmax = 0;
	ai = 0; bi = 0;
	ll c=0;
	rep(i,n){
		ll t;
		cin >> t;
		c += t;
		a.push_back(c);
		if(c <= k) ai=i+1;
	}
	c=0;
	rep(i,m){
		ll t;
		cin >> t;
		c += t;
		b.push_back(c);
		if(c <= k) bmax = i+1;
	}
	ll ans = max(ai,bmax);
	while(1){
		ll time = a[ai] + b[bi];
		if(time > k){
			ai--;
			if(ai < 0) break;
		}else{
			ans = max(ans, ai + bi);
			bi++;
			if(bi > m) break;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 8000
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

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

	cin >> N;
	vector<int>a(N);
	for (int i = 0; i < N; i++)cin >> a[i];
	vector<int>ans(N);
	vector<int>box(N + 1);
	box[0] = 1;
	for (int i = 0; i < N; i++) {
		box[N] = box[N - 1];
		for (int j = N - 1; j >= 0; j--) {
			if (j)box[j] = box[j - 1] + box[j] * (N - i);
			else box[j] *= N - i;
			box[j] %= N;
		}
	}
	vector<vector<int>>by(N, vector<int>(N, 1));
	for (int i = 0; i < N; i++) {
		for (int j = 1; j < N; j++) {
			by[i][j] = by[i][j - 1] * i;
			by[i][j] %= N;
		}
	}
	vector<int>rev(N);
	for (int i = 1; i < N; i++)rev[i] = power(i, N - 2, N);
	for (int i = 0; i < N; i++) {
		if (!a[i])continue;
		vector<int>add(N);
		add[N - 1] = box[N];
		for (int j = N - 2; j >= 0; j--) {
			add[j] = box[j + 1] + N - add[j + 1] * (N - i) % N;
			add[j] %= N;
		}
		int c = 0;
		for (int j = 0; j < N; j++) {
			c += add[j] * by[i][j];
			c %= N;
		}
		for (int j = 0; j < N; j++) {
			add[j] *= rev[c];
			add[j] %= N;
			ans[j] += add[j];
			ans[j] %= N;
		}
	}
	for (auto i : ans)cout << i << " ";
	cout << endl;
}

Measured memory_bytes: 37632
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

int gcd(int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

vector<int> Prime(int num) {
	vector<int>ret;
	ret.push_back(2);
	ret.push_back(3);
	for (int i = 5; i <= num; i += 6) {
		bool flag = true;
		for (int j = 2; j < ret.size(); j++) {
			if (ret[j] * ret[j] > i)break;
			if (i%ret[j] == 0) {
				flag = false;
				break;
			}
		}
		if (flag)ret.push_back(i);
		flag = true;
		for (int j = 2; j < ret.size(); j++) {
			if (ret[j] * ret[j] > i + 2)break;
			if ((i + 2) % ret[j] == 0) {
				flag = false;
				break;
			}
		}
		if (flag)ret.push_back(i + 2);
	}
	return ret;
}

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

	cin >> N;
	vector<long long int>v(N + 1);
	for (int i = N; i >= 0; i--)cin >> v[i];
	int g = 0;
	for (auto i : v) {
		g = gcd(g, abs(i));
	}
	set<int>s;
	for (int i = 1; i*i <= g; i++) {
		if (g%i == 0) {
			bool flag = true;
			for (int j = 2; j*j <= i; j++) {
				if (i%j == 0)flag = false;
			}
			if (flag)s.insert(i);
			flag = true;
			for (int j = 2; j*j <= g / i; j++) {
				if ((g / i) % j == 0)flag = false;
			}
			if (flag)s.insert(g / i);
		}
	}
	auto P = Prime(N);
	for (auto p : P) {
		auto w = v;
		for (auto &i : w) {
			i += MOD * p;
			i %= p;
		}
		for (int j = N; j >= p; j--) {
			w[j - p + 1] += w[j];
			w[j - p + 1] %= p;
			w[j] = 0;
		}
		auto sum = accumulate(w.begin(), w.end(), 0LL);
		if (!sum)s.insert(p);
	}
	s.erase(1);
	for (auto i : s)cout << i << endl;
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,z,w;
	int a[2000];
	cin>>n>>z>>w;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	cout<<max(abs(w-a[n-1]),abs(a[n-2]-a[n-1]))<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
from fractions import gcd
from functools import reduce
def lcm(a, b):
  return (a*b) // gcd(a, b)

def lcm_list(numbers):
  return reduce(lcm, numbers, 1)

n = int(input())
if n==1:
  print(int(input()))
  sys.exit()

t = [int(input()) for _ in range(n)]
print(lcm_list(t))

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

long long int psum[200010];
long long int pxor[200010];

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

	int n;
	long long int t;

	memset(psum,0,sizeof(psum));
	memset(pxor,0,sizeof(pxor));

	cin >> n;

	for(int i=1;i<=n;i++)
	{
		cin >> t;
		psum[i] = psum[i-1] + t;
		pxor[i] = pxor[i-1]^t;
	}

	long long int res = 0;
	for(int i=1;i<=n;i++)
	{
		int l = i;
		int r = n+1;
		while(l+1<r)
		{
			int mid = (l + r) / 2;
			long long int sum = psum[mid] - psum[i-1];
			long long int Xor = pxor[mid]^pxor[i-1];
			if(sum==Xor)
			{
				l = mid;
			}
			else
			{
				r = mid;
			}
		}
		//cout << l << ' ' << i << '\n';
		res += (l-i+1);
	}	

	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 3456
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
memo = []
for i in range(N):
    tmp = []
    a = A[i]
    d = 2
    while d*d <= a:
        while a%d == 0:
            tmp.append(d)
            a //= d
        d += 1
    if a!=1:
        tmp.append(a)
    memo.append(Counter(tmp))

lcm = Counter([])

for count in memo:
    for k,v in count.items():
        if k not in lcm:
            lcm[k] = v
        else:
            lcm[k] = max(lcm[k],v)
mod = 10**9 +7
LCM = 1
for k,v in lcm.items():
    LCM = LCM*pow(k,v)%mod

ans = 0
for a in A:
    ans = (ans + LCM*pow(a,mod-2,mod))%mod
print(int(ans))

Measured memory_bytes: 79804
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  int a, b, c, sum = 0;
  cin >> a >> b >> c;
  
  // Main loop
  for (int i = a; i <= b; i++){
    if (c % i == 0){
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll n;
    cin >> n;
    map<string, ll> mp;
    rep(i, n)
    {
        string s;
        cin >>s;
        mp[s]++;
    }
    ll m;
    cin >> m;
    rep(i, m)
    {
        string s;
        cin >> s;
        mp[s]--;
    }
    ll ans = 0;
    itr(it, mp)
    {
        ans = max(ans, it->sd);
    }
    cout << ans;
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
N, T = map(int, input().split())
t = list(map(int, input().split()))

ans = 0
now = t[0]
for i in range(0, N-1):
    next_t = t[i+1]
    if (next_t - now) >= T:
        ans += T
    else:
        ans += next_t - now
    now = next_t
ans += T
print(ans)

Measured memory_bytes: 25200
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define pi (acos(-1))

int main()
{

int r;
int D,x;
ll tmp;

std::cin>>r>>D>>x;
tmp=x;
for(int i=0;i!=10;++i){
tmp=r*tmp -D;
std::cout<<tmp<<std::endl;
}





    return 0;
}


Measured memory_bytes: 3628
# Aizu Problem ITP_1_10_C: Standard Deviation
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


while True:
    n = int(input())
    if n == 0:
        break
    A = [int(_) for _ in input().split()]
    mean = sum(A) / n
    sd = math.sqrt(sum([(a - mean)**2 for a in A]) / n)
    print("%.8f" % sd)

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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
typedef struct aaaaa{
  int x,y,t;
}Grid;
using namespace std;
ll hoge(ll h){
  ll ret=1;
  for(int i=0;i<h;i++)
    ret*=3;
  for(int i=0;i<h;i++){
    ret *= (4-i)/(i+1);
  }
  return ret;
}
int main(){
  ll n;cin>>n;
  ll nn=n;
  int keta=0;
  while(n>0){
    keta++;
    n/=10;
  }
  ll ans=0;
  ll kazu[1000]={};
  for(int i=3;i<keta;i++){
    kazu[i]=6*hoge(i-3);
  }
  vector<int>hh;
  ll hhh=nn;
  while(nn>0){
    hh.pb(nn%10);
    nn/=10;
  }

  for(int i=0;i<keta;i++){
    // ans+=kazu[i];
    //cout<<ans<<endl;
  }
  //  cout<<ans<<endl;
  bool flag=true;
  int hog[10]={0,0,0,1,0,1,0,1,0,0};
  ll ini=1;
  ll kake=1;
  for(int i=0;i<keta;i++){
    ini+=kake*3;
    kake*=10;
  }
  ini+=23;
  
  for(ll i=357;i<=hhh;){
    //cout<<i<<endl;
    if(hog[3]>0&hog[5]>0&hog[7]>0){
      //  cout<<hog[3]<<" "<<hog[5]<<" "<<hog[7]<<endl;
      ans++;
      //cout<<i<<endl;
    }
    // cout<<i<<" "<<hog[3]<<" "<<hog[5]<<" "<<hog[7]<<endl;
    if(i%10!=7){
      hog[i%10]--;
      i+=2;
      hog[i%10]++;
    }else{
      ll num=i;
      num/=10;
      hog[num%10]--;
      num++;
      i+=6;
      hog[7]--;
      hog[3]++;
      ll kake=10;
      //  ll plus=1;
     
      while(num>0){
	//cout<<i<<endl;
	ll nnn=(num)%10;
      	//cout<<nnn<<endl;
	if(nnn<=3){
	  i+=kake*(3-nnn);
	  hog[3]++;
	  break;
	}else if(nnn<=5){
	  i+=kake*(5-nnn);
	  hog[5]++;
	  break;
	}else if(nnn<=7){
	  i+=kake*(7-nnn);
	  hog[7]++;
	  break;
	}else{
	  i+=(13-nnn)*kake;
	  num/=10;
      	  hog[num%10]--;
	  // cout<<num%10<<endl;
	  num++;
	  hog[3]++;
	}
	kake*=10;
	//cout<<i<<endl;
      }
      //cout<<endl;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).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; }

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi h(n); rep(i, n) cin >> h[i];
  int ans = h[0];
  for (int i = 1; i < n; i++) {
    ans += max(h[i]-h[i-1],0);
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        var ans = new List<long>();
        long sum = 0;
        long index = 1;
        while (sum < N)
        {
            sum += index;
            ans.Add(index);
            index++;
        }
        if(sum!=N)
            ans.Remove(sum-N);

        foreach (var i in ans)
        {
            WriteLine(i);
        }
    }
}


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

int main()
{
	int n, m = 0;
	int d[50];

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> d[i];

	for (int i = 0; i < n; i++)
		m += d[i];

	m = m * m;

	for (int i = 0; i < n; i++)
		m -= d[i] * d[i];

	m /= 2;

	cout << m << endl;

	return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int X;
    cin >> X;
    int res = (X/500)*1000 + ((X%500)/5)*5;
    cout << res << endl;
    return 0;
}


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

using ll = long long int;

const int MAX_N = (int)(2e5 + 5);

int n, k;

ll ans;

int main(void){
  scanf("%d %d", &n, &k);

  if (k % 2 == 0) {
    int cnt_zero = 0;
    int cnt_half = 0;
    for (int i = 1; i <= n; ++i) {
      if (i % k == 0) cnt_zero += 1;
      else if (i % k == (k / 2)) cnt_half += 1;
    }
    ans = pow(cnt_zero, 3) + pow(cnt_half, 3);
  }
  else {
    int cnt_zero = 0;
    for (int i = 1; i <= n; ++i) {
      if (i % k == 0) cnt_zero += 1;
    }
    ans = pow(cnt_zero, 3);
  }

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

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if( x<r || y<r || x>W-r || y>H-r ){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long

const int Mod=1e9+7;
struct Edge{
	ll x,y,z;
	inline bool operator<(const Edge&a)const{
		return z<a.z;
	}
}o[2015];
struct edge{
	ll to,cost;
	edge(ll to,ll cost):to(to),cost(cost){}
};
ll n,m,f[2015],num,mx[2011][2011];
ll k,ans,sum1,sum2;
vector<edge>e[2015];
int gf(int x){
	return x==f[x]?x:f[x]=gf(f[x]);
}
inline int pow(int a,int b){
	int sum=1;
	while(b){
		if(b&1)sum=1ll*sum*a%Mod;
		a=1ll*a*a%Mod,b>>=1;
	}
	return sum;
}
void dfs(int o,int x,int fa){
	for(int i=0;i<e[x].size();++i)
		if(e[x][i].to!=fa)
			mx[o][e[x][i].to]=max(mx[o][x],e[x][i].cost),dfs(o,e[x][i].to,x);
}
inline int calc(ll x){
  int cnt=m;
  for(int i=1;i<=m;i++)
    if(ans+o[i].z-mx[o[i].x][o[i].y]) cnt--;
  int p=1; cnt=cnt==m?cnt:cnt+1;
  for(int i=1;i<=cnt;i++) p=2LL*p%Mod;
  return p;
}
int main(void){
	ll i,x,y,z;
	scanf("%lld%lld%lld",&n,&m,&k);
	for(i=1;i<=n;++i)f[i]=i;
	for(i=1;i<=m;++i)scanf("%lld%lld%lld",&o[i].x,&o[i].y,&o[i].z);
	sort(o+1,o+m+1);
	for(i=1;i<=m;++i){
		x=o[i].x,y=o[i].y;
		if(gf(x)==gf(y))continue;
		ans+=o[i].z,f[gf(x)]=gf(y),e[x].push_back(edge(y,o[i].z)),e[y].push_back(edge(x,o[i].z));
	}
	for(i=1;i<=n;++i)
		dfs(i,i,0);
	num=m;
	for(i=1;i<=m;++i){
		x=o[i].x,y=o[i].y;
		if(ans-mx[x][y]+o[i].z<k)--num;
	}
	if(num==m)sum1=pow(2,num);
	else sum1=pow(2,num+1);
	num=m;
	for(i=1;i<=m;++i){
		x=o[i].x,y=o[i].y;
		if(ans-mx[x][y]+o[i].z<k+1)--num;
	};
	if(num==m)sum2=pow(2,num);
	else sum2=pow(2,num+1);
	sum1-=sum2;if(sum1<0)sum1+=Mod;
	printf("%d\n",sum1);
	return 0;
}

Measured memory_bytes: 16384
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define chmax(x, y) x = max(x, y) 
ll dp[3005][3005][4] ;
int a[3005][3005] ;
int main(){
    int R,C,K ;
    cin >> R >> C >> K ;
    rep(i, K){
        int r, c, v ;
        cin >> r >> c >> v ;
        a[r-1][c-1] = v ;
    }
    rep(i, R){
        rep(j, C){
            for(int k = 2; k >= 0; k--){
                chmax(dp[i][j][k+1], dp[i][j][k] + a[i][j]) ;
            }
            rep(k, 4){
                chmax(dp[i+1][j][0], dp[i][j][k]) ;
                chmax(dp[i][j+1][k], dp[i][j][k]) ;
            }
        }
    }
    ll ans = 0 ;
    rep(k, 4){
        chmax(ans, dp[R-1][C-1][k]) ;
    }
    cout << ans << endl ;
}

Measured memory_bytes: 320548
#include<iostream>
using namespace std;
int d, e;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == 5) {
		d++;
	}
	if (a == 7) {
		e++;
	}
	if (b == 5) {
		d++;
	}
	if (b == 7) {
		e++;
	}
	if (c == 5) {
		d++;
	}
	if (c == 7) {
		e++;
	}
	if (d == 2 && e == 1) {
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/abc057/tasks/abc057_b

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 50
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int a,b,c;
int main() {
    cin >> a >> b >> c;
    bool flag = ((b-a)==(c-b));
    print(flag ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int n; pair<int, int> d[25];
int main() {
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) cin >> d[i].second >> d[i].first;
		sort(d, d + n);
		int s = 0, f = 0;
		for (int i = 0; i < n; i++) {
			s += d[i].second;
			if (d[i].first < s) {
				f = 1; break;
			}
		}
		cout << (f ? "No" : "Yes") << endl;
	}
	return 0;
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
char s[200][200];
int h_flag[200];
int w_flag[200];
int main(){
	int h,w;
	//cin>>h>>w;
	scanf("%d%d",&h,&w);
	//cout<<h<<" "<<w<<endl;
	for(int i=0;i<h;i++){
		
		for(int j=0;j<=w;j++){
			scanf("%c",&s[i][j]);
			
			if(s[i][j]=='.'){
				h_flag[i]++;
				w_flag[j]++;
			}
		}
	}
	/*for(int i=0;i<=h;i++){
		for(int j=0;j<=w;j++){
			printf("%c",s[i][j]);
		}
		printf("\n");
	}
	for(int i=0;i<h;i++)cout<<h_flag[i]<<" ";
	cout<<endl;*/
	for(int i=0;i<h;i++){
		if(h_flag[i]==w)continue;
		for(int j=0;j<=w;j++){
			if(w_flag[j]==h)continue;
			printf("%c",s[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
import heapq 
import math 
n,m = map(int,input().split())
a = list(map(lambda x:int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
    p = heapq.heappop(a)
    p = math.ceil(p/2)
    heapq.heappush(a,p)
print(sum(a)*(-1))

Measured memory_bytes: 14532
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int A = sc.nextInt();
        int B = sc.nextInt();
        String U = sc.next();
        if(U.equals(S))A--;
        else B--;
        System.out.println(A+" "+B);
    }

    public static void main(String[] args) {
        new Main();
    }
}


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

int n, q;
int seg[1<<22];

void init() {
  int _n = n;
  n = 1;
  while (n < _n) n <<= 1;
}

void add(int a, int v) {
  a += n - 1;
  seg[a] += v;
  while (a) {
    a = (a - 1) / 2;
    seg[a] = max(seg[2 * a + 1], seg[2 * a + 2]);
  }
}

int idx() {
  int v = seg[0];
  int k = 0;
  while (k < n - 1) {
    int l = 2 * k + 1;
    int r = 2 * k + 2;
    if (seg[l] == v) k = l;
    else k = r;
  }

  return k - n + 2;
}

void solver(int a, int v) {
  add(--a, v);
  cout << idx() << " " << seg[0] << endl;
}

int main() {
  cin >> n >> q;
  init();

  while (q--) {
    int a, v;
    cin >> a >> v;
    solver(a, v);
  }
}

Measured memory_bytes: 10916
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int pri[3],A,B;
int main()
{
	for(int i=0;i<3;i++) scanf("%d",&pri[i]);
	pri[2]*=2;
	scanf("%d%d",&A,&B);
	if(pri[0]+pri[1]<pri[2])
		printf("%d\n",A*pri[0]+B*pri[1]);
	else
	{
		int ans=0,pus=min(A,B);
		ans+=pus*pri[2];
		A-=pus;B-=pus;
		if(pri[0]<pri[2]) ans+=A*pri[0];
		else ans+=A*pri[2];
		if(pri[1]<pri[2]) ans+=B*pri[1];
		else ans+=B*pri[2];
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 128
s=str(input())
l=len(s)
ans=99999999999
for j in s:
  temp=j
  a=0
  cnt=0
  for i in range(l):
    if s[i]!=temp:
      cnt=cnt+1
    else:
      a=max(a,cnt)
      cnt=0
  a=max(a,cnt)
  ans=min(a,ans)
print(ans)

Measured memory_bytes: 3064
using System;

namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int H = int.Parse(s.Split(' ')[0]);
            int W = int.Parse(s.Split(' ')[1]);
            bool[,] paint = new bool[H, W];
            for (int i = 0; i < H;i++){
                s = Console.ReadLine();
                for (int j = 0; j < W;j++){
                    paint[i,j] = (s[j] == '#');  //黒をtrueとする
                }
            }
            //チェック部
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if(paint[i,j]){
                        //上下左右どこかに黒があれば良い
                        if (i != 0 && paint[i - 1, j]) continue;//上
                        if (i != H-1 && paint[i + 1, j]) continue;//下
                        if (j != 0 && paint[i, j - 1]) continue;//左
                        if (j != W - 1 && paint[i, j + 1]) continue;//右
                        //作れない
                        Console.WriteLine("No");
                        return;
                    }
                }
            }
            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 11092
A=[]
B=[[1 for i in range(3)]for j in range(3)]
A.append(list(map(int,input().split(" "))))
A.append(list(map(int,input().split(" "))))
A.append(list(map(int,input().split(" "))))
n=int(input())
for i in range(n):
  num=int(input())
  for l in range(3):
    if num in A[l]:
      N=A[l].index(num)
      B[l][N]=0
a=0
f=0
h=0
for i in range(3):
  if sum(B[i])==0:
    a=1
    break
  g=0
  f=f+B[i][i]
  h=h+B[i][2-i]
  for j in range(3):
    g=g+B[j][i]
  if g==0:
    a=1
    break

if a==1 or f==0 or h==0:
  print("Yes")
else:
  print("No")
  
 
  

Measured memory_bytes: 3064
#include <stdio.h>
#define N 100

int main(){
  int n,i,j,u,k,x,a[N][N];

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
    a[i][j] = 0;
    }
  }
  for(i = 0;i < n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j = 0;j < k;j++){ //x=連結
	scanf("%d",&x);
	x--;
	a[u][x] = 1;
      }
  }

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      if(j != 0) printf(" ");
      printf("%d",a[i][j]);
    }
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2132
def main():
    N = int(input())
    r = [int(input()) for _ in range(N)]

    maxv = r[1] - r[0]
    minv = r[0]

    for j in range(1,N):
        temp = r[j] - minv
        if maxv < temp:
            maxv = temp

        if minv > r[j]:
            minv = r[j]

    return maxv

print(main())



Measured memory_bytes: 17312