akhauriyash/Code-Regression huggingface dataset:
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
ll val[100000000];
ll s;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>val[i];
	}
	val[n+1]=1000000000;
	sort(val+1,val+n+1);
	for(int i=1;i<=n-2;i++)
	{
		for(int j=i+1;j<=n-1;j++)
		{
			int ans=val[i]+val[j];
			int l=j+1,r=n+1;
			while(l<=r)
			{
				int mid=(l+r)/2;
				if(val[mid]<ans)
					l=mid+1;
				else
					r=mid-1;
			}
			r++;
			s+=r-j-1;
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 256
s = gets.to_i
a = [s]
offset = 0

if s == 1
  offset = 2
elsif s == 2
  offset = 1
else
  offset = 3
end

while a.last != 4
  if a.last.even?
    a.push(a.last / 2)
  else
    a.push(a.last * 3 + 1)
  end
end

puts a.length + offset

Measured memory_bytes: 1788
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int n, k, t;
long long ans = 0;

int main() {
  scanf("%d%d", &n, &k);
  if (k % 2 == 0) t = k / 2;
  else t = k;
  long long s;
  for (int i = t; i <= n; i += t) {
    if (i % k == 0) s = n / k;
    else s = (n + t) / k;
    ans += s * s;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
a,b,k=map(int,input().split())
s=set()
for i in range(a,a+k):
    if i<=b:
        s.add(i)
for i in range(b,b-k,-1):
    if i>=a:
        s.add(i)
l=list(s)
l.sort()
#print(l)
for i in l:
    print(i)



Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

int H,W;
char S[24][24];
int visited[24][24];

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

int BFS(const pair<int,int>& s,int tag){
    queue<pair<int,int>> q;
    queue<int> d;
    int ret=0;

    d.push(0);
    q.push(s);
    visited[s.first][s.second]=tag;

    while (!q.empty()){
        int dist=d.front();
        int x=q.front().first,y=q.front().second;

        ret=dist;

        d.pop(),q.pop();
        for(int i=0;i<4;i++){
            int nx=x+dx[i],ny=y+dy[i];
            if (nx<1||nx>H) continue;
            if (ny<1||ny>W) continue;
            if (S[nx][ny]=='#'||visited[nx][ny]==tag) continue;

            d.push(dist+1);
            q.push(pair<int,int>(nx,ny));
            visited[nx][ny]=tag;
        }
        
    }
    
    return ret;
}

int main(){

    scanf("%d%d",&H,&W);
    for(int i=1;i<=H;i++) scanf("%s",S[i]+1);

    int k=1;
    int ans=0;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            if (S[i][j]=='#') continue;
            ans=max(ans,BFS(pair<int,int>(i,j),k++));
        }
    }

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

    return 0;
}

Measured memory_bytes: 3236
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        if(s.length()%2!=0){
            System.out.println("No");
            return;
        }
        for(int i=0;i<s.length();i+=2)
        {
            if(!s.substring(i,i+2).equals("hi"))
            {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 21844
n = int(input())
inp = {}
for i in range(n):
    a = input()
    if inp.get(a) is None:
        inp[a] = 0
    inp[a] += 1
print(f"AC x {0 if inp.get('AC') is None else inp.get('AC')}")
print(f"WA x {0 if inp.get('WA') is None else inp.get('WA')}")
print(f"TLE x {0 if inp.get('TLE') is None else inp.get('TLE')}")
print(f"RE x {0 if inp.get('RE') is None else inp.get('RE')}")


Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    int n[1000] = {0};
    for(int i = 1;i < 1000;i++)
    {
        n[i] = n[i - 1] + i;
    }
    cout << n[b - a - 1] - a;

    return 0;
}

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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> a(n), b(n-1);
    for (size_t i = 0; i < n-1; i++) cin >> b[i];

    a[n-1] = b[n-2];
    for (int i = n-2; i > 0; i--) {
        if (b[i-1] <= b[i]) a[i] = b[i-1];
        else a[i] = b[i];
    }
    a[0] = b[0];

    int ans = 0;
    for (size_t i = 0; i < n; i++) ans += a[i];
    cout << ans << endl;
    return 0;
}


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

int main()
{
  int N, K;
  bool nums[10] = {};
  
  cin >> N >> K;
  for(int i = 0; i < K; i++) {
    int D;
    cin >> D;
    nums[D] = true;
  }

  while(true) {
    stringstream sss;
    sss << N;
    string S = sss.str();
    bool flag = true;
    for(char& c: S)  flag &= !nums[c - '0'];
    if(flag) {
      cout << N << endl;
      break;
    }
      
    ++N;
  }
  
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
int main(){
    int n, count1=0, count2=0;
    int a[101],b[101], c[101];
    lp(i,101){
        a[i]=0;
        b[i]=0;
        c[i]=0;
    }
    cin>>n;
    int x;
    cin>>x;
    lp(i,x){
        int c;
        cin>>c;
        a[c]++;
    }
    int y;
    cin>>y;
    lp(i,y){
        int c;
        cin>>c;
        b[c]++;
    }
    int z;
    cin>>z;
    lp(i,z){
        int d;
        cin>>d;
        c[d]++;
    }
    lp(i,101){
        if(b[i] + c[i] == 2) count1++;
    }
    lp(i,101){
        if(c[i] - b[i] - a[i] == 1) count2++;
    }
    cout<<count1 + count2<<endl;
    return 0;
}



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

int main(){

    char b;
    cin>>b;

    if(b=='A') cout<<"T"<<endl;
    if(b=='T') cout<<"A"<<endl;
    if(b=='G') cout<<"C"<<endl;
    if(b=='C') cout<<"G"<<endl;






    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	if(a%b!=0)return gcd(b,a%b);
	else return b;
}
int main(){
	int n;
	cin>>n;
	long long ans=0;
	for(int a=1;a<=n;a++)
	for(int b=1;b<=n;b++)
	for(int c=1;c<=n;c++)
	ans+=gcd(gcd(a,b),gcd(b,c));
	cout<<ans;
}


Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef std::uint64_t u64;
typedef std::int64_t  i64;
typedef std::uint32_t u32;
typedef std::int32_t  i32;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl

int main(int argc, const char* argv[]) {
  u64 a, b, c;
  cin >> a >> b >> c;
  
  cout << min(b/a, c) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let n = get!(usize);
    let v = get!([usize]);
    let mut same = Vec::new();
    for i in 0..n {
        if i + 1 == v[i] {
            same.push(i + 1);
        }
    }
    if same.is_empty() {
        println!("0");
        return;
    }
    //eprintln!("v: {:?}", v);
    //eprintln!("same: {:?}", same);
    let mut ans = same.len();
    let mut i = 1;
    while i < same.len() {
        //eprintln!("{}", i);
        if same[i] - same[i - 1] == 1 {
            ans -= 1;
            i += 2;
            continue;
        }
        i += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
IDENTIFICATION DIVISION.
      PROGRAM-ID. 101B.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(10).
      01 N   PIC 9(10).
      01 K.
      	03 WK-K PIC 9(1) OCCURS 10 TIMES.
      01 ANS PIC 9(10).
      01 SHO PIC 9(10).
      01 AMA PIC 9(10).
      01 IDX PIC 9(2).
      
      PROCEDURE DIVISION.
      ACCEPT INP.
      
      MOVE INP TO N.
      MOVE INP TO K.
      
      MOVE 1 TO IDX.
      PERFORM UNTIL IDX = 10 OR WK-K(IDX) = SPACE
      ADD WK-K(IDX) TO ANS
      ADD 1 TO IDX

      END-PERFORM.
            
      DIVIDE N BY ANS GIVING SHO REMAINDER AMA
      
      IF AMA = 0
      	DISPLAY "Yes"
      ELSE
      	DISPLAY "No"
      END-IF.
      

      STOP RUN.

Measured memory_bytes: 384
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define Rint register int
#define Temp template<typename T>
#define mem(a,b) memset(a,(b),sizeof(a))
using namespace std;
typedef long long LL;
Temp inline void chkmin(T &x,T y){if(y<x)x=y;}
Temp inline void chkmax(T &x,T y){if(y>x)x=y;}
Temp inline void read(T &x){
	x=0;T w=1,ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
	x=x*w;
}
LL n,pos;
int main(){
	read(n);
	while(1){
		if(pos*pos>n)break;
		pos++;
	}
	pos--;
	printf("%lld\n",pos*pos);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  long long la,lb;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  //if(a > 9 || b > 9) ans = -1;
  //else ans = a*b;
  
  if(s == "SUN")ans = 7;
 else if(s == "MON")ans = 6;
 else if(s == "TUE")ans = 5;
 else if(s == "WED")ans = 4;
 else if(s == "THU")ans = 3;
 else if(s == "FRI")ans = 2;
 else if(s == "SAT")ans = 1;

  cout << ans << endl;

}

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

const int mod = 1e9 + 7;
const int MAX = 123456;

long long fac[MAX], finv[MAX], inv[MAX];

inline void mod_add(long long &x, long long y) {
	x += y;
	if(x >= mod) x -= mod;
}

inline void mod_sub(long long &x, long long y) {
	x -= y;
	if(x < 0) x += mod;
}

inline long long mod_mul(long long x, long long y) {
	return (long long) (x % mod * y % mod);
}

inline long long mod_inv(long long x) {
	x %= mod;
	if(x < 0) x += mod;
	long long y = mod, u = 0, v = 1;
	while(y) {
		long long t = y / x;
		y -= t * x; swap(x, y);
		u -= t * v; swap(u, v);
	}
	if(u < 0) u += mod;
	return u;
}

inline long long mod_pow(long long x, long long y) {
	long long res = 1;
	while(y) {
		if(y & 1) res = mod_mul(res, x);
		x = mod_mul(x, x);
		y >>= 1;
	}
	return res;
}

inline void pre_mod_nCk() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < MAX; i++) {
		fac[i] = mod_mul(fac[i - 1], i);
		inv[i] = mod - mod_mul(inv[mod % i], mod / i);
		finv[i] = mod_mul(finv[i - 1], inv[i]);
	}
}

inline long long mod_nCk(int n, int k) {
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return mod_mul(fac[n], mod_mul(finv[k], finv[n - k]));
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	pre_mod_nCk();
	int n, m;
	cin >> n >> m;
	multiset<int> st;
	for(int i = 2; i * i <= m; i++) {
		int cnt = 0;
		while(m % i == 0) {
			m /= i;
			cnt++;
		}
		if(cnt) st.insert(cnt);
	}
	if(m != 1) st.insert(1);
	long long ans = 1;
	for(auto i : st) {
		ans *= mod_nCk(i + n - 1, n - 1);
		ans %= mod;
	}
	cout << ans << endl;
	return 0;	
}

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

int main(){
  long N, A, B;
  cin >> N >> A >> B;
  if(A>B){
    cout << "0" << endl;
    return 0;
  }
  if(N==1){
    if(A!=B) cout << "0" << endl;
    else cout << "1" << endl;
    return 0;
  }
  cout << (N-2)*(B-A)+1 << endl;
  return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main() {
    string s;
    cin>>s;
    string S=s;
    int z=s.size();
    rep(i,z){
        for(int k=0;k<z-i;k++){
            s.erase(i,k);
            if(s=="keyence"){
                cout<<"YES"<<endl;
                return 0;
            }
            s=S;
        }
    }
    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream &operator << (ostream &os, const vector<T> &);
template<size_t n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, const tuple<T...> &){}
template<size_t n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream &os, const tuple<T...> &t){
    os << (n == 0 ? "" : " ") << get<n>(t); _ot<n+1>(os, t);
}
template<class...T> ostream &operator << (ostream &os, const tuple<T...> &t){
    _ot<0>(os, t); return os;
}
template<class T, class U> ostream & operator << (ostream &os, const pair<T,U> &p){
    return os << "(" << p.first << ", " << p.second << ") ";
}
template<class T> ostream &operator << (ostream &os, const vector<T> &v){
    for(size_t i = 0; i < v.size(); i++) os << v[i] << (i + 1 == v.size() ? "" : ", "); return os;
}
#ifdef DEBUG
#define dump(...) (cerr << #__VA_ARGS__ << " = " << make_tuple(__VA_ARGS__) \
                   << " (L : " << __LINE__ << ")" << endl)
#else
#define dump(...)
#endif
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef long long ll;
// #define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
void fastios(){ ios_base::sync_with_stdio(0); cin.tie(0); }
int const mod = 1000000007;
auto const inf = numeric_limits<int>::max()/8;

using Weight = long long;
using Capacity = int;
struct Edge {
    int src, dst; Weight weight;
    Edge(int s, int d, int w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

int V,E,r;

pair<vector<Weight>, bool> bellmanFord(const Graph &g, int s){
    int n = g.size(); const Weight inf = numeric_limits<Weight>::max() / 8;
    Edges es;
    for(int i = 0; i < n; i++) for(auto &e : g[i]) es.emplace_back(e);
    vector<Weight> dist(n, inf); dist[s] = 0;
    bool negCycle = false;
    for(int i = 0;; i++){
        bool update = false;
        for(auto &e : es){
            if(dist[e.src] != inf && dist[e.dst] > dist[e.src] + e.weight){
                dist[e.dst] = dist[e.src] + e.weight;
                update = true;
            }
        }
        if(!update) break;
        if(i > V) {
            negCycle = true;
            break;
        }
    }
    return make_pair(dist, !negCycle);
}

int main(){
    while(cin >> V >> E >> r){
        Graph g(V);
        rep(i,E){
            int a,b,c;
            cin >> a >> b >> c;
            g[a].eb(a,b,c);
        }
        auto ans = bellmanFord(g,r);
        if(ans.second){
            for(int i = 0; i < V; i++){
                if(ans.first[i] > 1e10) cout << "INF";
                else cout << ans.first[i];
                cout << endl;
            }
        } else {
            cout << "NEGATIVE CYCLE" << endl;
        }
    }
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;

int main() {FIN
	
	ll a, b, c, k, s = 0;
	cin >> a >> b >> c >> k;
	s += min(a, k);
	k -= min(a, k);
	k -= min(b, k);
	s -= min(c, k);
	
	cout << s << "\n";
		
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

template <typename T>
vector<T> divisor(T n) {
  vector<T> ret;
  for (T i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  return ret;
}

int main(void) {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep (i, n) cin >> a[i];
  int  maxi = accumulate(all(a), 0);
  auto div  = divisor(maxi);
  sort(all(div), greater<int>());
  allrep (d, div) {
    vector<int> b(a);
    allrep (x, b) x %= d;
    sort(all(b));
    int l = 0, r = n - 1, lcnt = 0, rcnt = 0;
    while (1) {
      while ((b[l] == 0 || b[l] == d) && l < n - 1) ++l;
      while ((b[r] == d || b[r] == 0) && r > 0) --r;
      if (r < l) break;
      if (lcnt < rcnt) {
        lcnt += b[l];
        b[l]  = 0;
      } else {
        rcnt += d - b[r];
        b[r]  = d;
      }
    }
    if (lcnt <= k) {
      cout << d << endl;
      break;
    }
  }
  return 0;
}

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

int main()
{
  int N;
  cin >> N;
  int *B;
  B = (int *)malloc(sizeof(int)*(N-1));

  int i;
  for (i=0;i<N-1;i++){
    cin >> B[i];
  }

  int ans = 0;

  ans += B[N-2];
  for (i=N-2;i>0;i--){
    if (B[i] > B[i-1]){
      ans += B[i-1];
    }else {
      ans += B[i];
    }
  }
  ans += B[0];

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int A,B,C;
    cin >> A >> B >> C;
    if(C < A-B) cout << 0 << endl;
    else cout << C- (A-B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;

const int MAX_N = 2*1e5 + 5;

int main(){
    int N; cin >> N;
    vector<int> C(N+1, 0);
    rep(i, 1, N + 1) cin >> C[i];

    unordered_map<int, mint> SUM;
    mint dp[MAX_N];
    dp[0] = 1;
    rep(i, 1, N + 1){
        dp[i] = dp[i-1];
        if(i != N && C[i] == C[i+1]) continue;

        dp[i] += SUM[C[i]];
        SUM[C[i]] += dp[i-1];
    }
    mint ans = 1;
    //rep(i, 0, N + 1) cout << i << " " << dp[i] << endl;
    cout << dp[N] << endl;
}

Measured memory_bytes: 10056
#include <bits/stdc++.h>
using namespace std;
int main() {
    set<char> odd = {'R','U','D'};
    set<char> even = {'L','U','D'};
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i++) {
        if((i + 1) % 2 == 0) {
            if(even.count(s.at(i)) == 0) {
                cout << "No" << endl;
                return 0;
            }
        }else if(odd.count(s.at(i)) == 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] A = new long[N];
        long[] X = new long[N];
        X[0] = 0;

        for(int i=0;i<N;i++){
            A[i] = sc.nextLong();
            if(i % 2 == 0){
                X[0] += A[i];
            } else {
                X[0] -= A[i];
            }
        }
        System.out.print(X[0] + " ");

        for(int i =1; i<N-1;i++){
            X[i] = 2*A[i-1] - X[i-1];
            System.out.print(X[i] + " ");
    }
        System.out.print(2*A[N-1] - X[0]);

    }



}


Measured memory_bytes: 64244
#include<stdio.h>
#include<string.h>
int n,i,j,p;
char c,t,l[60];
int main()
{
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		p=30;
		memset(l,0,60);
		for(;scanf("%c",&l[p])!=-1;)
		{
			~scanf("%c",&c);
			if(c=='-'||c=='<')
				getchar(),c=='-'?p++:p--;
			else
				break;
		}
		for(j=0;!l[j];j++);
		puts(l+j);
	}
	return 0;
}

Measured memory_bytes: 588
import sys
sys.setrecursionlimit(10**6)

N = int(input())

def dfs(v, u, w):
    if w % 2 == 0:
        iro[v] = 0
    else:
        iro[v] = 1
    for i in ki[v]:
        if i[1] == u: continue
        dfs(i[1], v, w + i[0])
    return

ki = [[] for _ in range(N)]
for i in range(N - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    ki[u].append((w, v))
    ki[v].append((w, u))

iro = [0] * N
dfs(0, 0, 0)
for i in iro:
    print(i)

Measured memory_bytes: 81328
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const int N = 305, mod = 1e9 + 7;
const int inf = 1e9;
void solve(){
    int n, k;
    cin >> n >> k;
    vi a(n);
    for(int &i : a){
        cin >> i;
    }
    sort(all(a));
    ll ans = 0;
    for(int i = 0; i < k; i++){
        ans += a[i];
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A.sort()
B.sort()
C.sort()
B += [10 ** 9 + 1] + [0]    # B[-1] = 0, B[N] = 10**9 + 1となるようにする
C += [10 ** 9 + 1] + [0]    # C[-1] = 0, C[N] = 10**9 + 1となるようにする

# For each j = 0, 1, ..., N-1,
# find k such that B[j] < C[k] and (C[k-1] <= B[j] or k = 0)
# Let K[j] = k for such k.
# If such k doesn't exist, let K[j] := N
K = [0] * N

for j in range(N):
    ng = -1 # C[ng] <= B[j]
    ok = N  # B[j] < C[ok]
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if B[j] < C[mid]:
            ok = mid
        else:
            ng = mid
    K[j] = ok

# Let
# f[j] := B[j]より大きいC[k]の数 + B[j + 1]より大きいC[k]の数
#           ... + B[N-1]より大きいC[k]の数
f = [0] * (N - 1) + [N - K[N - 1]]
for j in range(N - 2, -1, -1):
    f[j] = f[j + 1] + N - K[j]

ans = 0
for i in range(N):
    # find j such that B[j - 1] <= A[i] < B[j]
    ng = -1  # B[ng] <= A[i]
    ok = N   # A[i] < B[ok]
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if A[i] < B[mid]:
            ok = mid
        else:
            ng = mid
    if ok >= N: continue
    # 0 <= ok <= N - 1
    ans += f[ok]

print(ans)

Measured memory_bytes: 24220
#include <bits/stdc++.h>
using namespace std;
 
const int N = 2005;
const int mod = 1e9 + 7;
 
int n, k, a[N];
int bigger[N], bigger_all[N];
 
void add(int &x, int y) {
    x += y; while(x >= mod) x -= mod;
}
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
 
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j < i; ++j) {
            bigger[i] += a[j] > a[i];
        }
        for (int j = 1; j <= n; ++j) {
            bigger_all[i] += a[j] > a[i];
        }
    }
 
    int res = 0;
    int x = (1LL * (k - 1) * k / 2) % mod;
    for (int i = 1; i <= n; ++i) {
        add(res, 1LL * bigger[i] * k % mod);
        add(res, 1LL * x * bigger_all[i] % mod); 
    }
 
    cout << res << endl;
}


Measured memory_bytes: 256
object Main{
  def main(args:Array[String]) : Unit = {
    val sc = new java.util.Scanner(System.in)
    var ans = ""
    while (sc.hasNext){
      val st = sc.next
      if (st == "-"){
        return 
      }
      ans = st
      val m = sc.nextInt
      for (i <- 0 until m){
        val h = sc.nextInt
        ans = shaffle(ans, h)
      }
      println(ans)
    }
  }
  def shaffle(st: String, h: Int) : String = {
    st.slice(h, st.size) + st.slice(0, h)
  }
}

Measured memory_bytes: 45248
a, b, c, d = [int(i) for i in input().split()]

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

def count(a, b, c):
    d = a // b
    e = a // c
    f = a // lcm(b, c)
    return a - d - e + f
ans = count(b, c, d) - count(a, c, d)
if(a % c != 0 and a % d != 0):
    ans += 1
print(ans)

Measured memory_bytes: 3064
from collections import deque

n,q=map(int,input().split())
E=[[]for _ in range(n)]
P=[0]*n
V=[False]*n
for i in range(n-1):
    a,b=map(int,input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
for i in range(q):
    p,x=map(int,input().split())
    P[p-1]+=x

que=deque([0])
while que:
    s=que.popleft()
    V[s]=True
    for ni in E[s]:
        if V[ni]==False:
            P[ni]+=P[s]
            que.append(ni)
print(*P)

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

int main() {
    int N;
    string S;
    cin >> N;

    for(int i=0; i<N; i++){ 
            cin >> S;

        if(S=="Y"){
            cout << "Four"<< endl;
            break;
        }
    }
    if(S!="Y"){
            cout << "Three"<< endl;
    }
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
C = (10**5+1)*[0]
T = sum(A)

for a in A:
  C[a]+=1

for q in range(Q):
  b,c = map(int,input().split())
  T+=C[b]*(c-b)
  C[c]+=C[b]
  C[b]=0
  print(T)

Measured memory_bytes: 20832
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int P,Q,R;
	scanf("%d %d %d",&P,&Q,&R);

	printf("%d\n",min(P+Q,min(P+R,Q+R)));

	return 0;
}


Measured memory_bytes: 256
N,C = map(int,input().split())
D = [list(map(int,input().split())) for i in range(C)]
c = [list(map(int,input().split())) for i in range(N)]
m0 = []
m1 = []
m2 = []
for i in range(N):
    for j in range(N):
        if (i+j+2)%3 == 0:
            m0.append(c[i][j])
        elif  (i+j+2)%3 == 1:
            m1.append(c[i][j])
        else:
            m2.append(c[i][j])
cost = [[0]*C for i in range(3)]
for m in m0:
    for color in range(C):
        cost[0][color] += D[m-1][color] 
for m in m1:
    for color in range(C):
        cost[1][color] += D[m-1][color] 
for m in m2:
    for color in range(C):
        cost[2][color] += D[m-1][color] 
#print(cost)
res = 10**10
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i == j or j == k or k == i:
                continue
            res = min(cost[0][i]+cost[1][j]+cost[2][k],res)
print(res)
 

Measured memory_bytes: 7696
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

res = 0
0.step([x / 500, a].min) do |i|
  0.step([(x - 500 * i) / 100, b].min) do |j|
    0.step([(x - 500 * i - 100 * j) / 50, c].min) do |k|
      if 500 * i + 100 * j + 50 * k == x
        res += 1
      end
    end
  end
end

puts res

Measured memory_bytes: 1788
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main() {
	int N, t = 0, n;
	cin >> N;
	rep(i, 0, N) {
		cin >> n;
		t ^= n;
	}
	puts(t == 0 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 384
import sys
def main():
	n = int(input())
	S1 =input()
	S2 =input()
	ans  = 1
	mod = 10**9+7
	i = 0
	if S1[0]==S2[0]:
		ans = 3
		i=1
	else:
		ans = 6
		i = 2
	while i<n:
		if S1[i]==S2[i]:
			if S1[i-1]==S2[i-1]:
				ans = (ans*2)%mod
			i = i+1
		else:
			if S1[i-1]==S2[i-1]:
				ans = (ans*2)%mod
			else:
				ans = (ans*3)%mod
			i = i+2
	print(ans)

if __name__ == "__main__":
	main()

Measured memory_bytes: 61940
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 998244353;
// #define LOCAL LDD
// #define int LL

const int N = 3002;
LL dp[N][N];

LL solve(int ps,int lft,vector<int>& a){
  if(lft<0) return 0; 
  if(ps==a.size()){
    if(lft==0) return 1;
    else return 0;
  }
  if(dp[ps][lft]!=-1) return dp[ps][lft];
  LL ans = 0;
  ans += solve(ps+1,lft-a[ps],a);
  ans += solve(ps+1,lft,a);
  if(lft==0) ans += 1;
  ans %= MOD;
  return dp[ps][lft] = ans;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  memset(dp,-1,sizeof(dp));
  int n,s;cin >> n >> s;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  LL ans = 0;
  for(int i=0;i<n;i++){
    ans += solve(i,s,a);
  }
  ans %= MOD;
  cout << ans << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

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

int main(){
    string s,t;
    cin>>s>>t;
    int A,B;
    cin>>A>>B;
    string u;
    cin>>u;
    if(u == s){
        cout<<A-1<<" "<<B<<endl;
    }else{
        cout<<A<<" "<<B-1<<endl;
    }
     
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
  String a=in.nextLine();
  String b=in.nextLine();
  int count=0;
        for (int i = 0; i <b.length(); i++) {
            if (a.charAt(i)!=b.charAt(i)) {
                count++;
                
            }
            
        }
        System.out.println(count);
  
   
    }
    
}
   

      


Measured memory_bytes: 42148
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  unsigned long long int a, b;
  cin >> a >> b;
  cout << min(a % b, b - a % b) << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
ans = "-1"
def dfs(n,S,s):
    global ans
    if n == 0:
        s_0 = S[0]
        dfs(n+1,S,s_0)
    else:
        s_1 = s + "+" + S[n]
        s_2 = s + "-" + S[n]
        if n != len(S) - 1:
            dfs(n+1,S,s_1)
            dfs(n+1,S,s_2)
        elif eval(s_1) == 7:
            ans = s_1 + "=7"
        elif eval(s_2) == 7:
            ans = s_2 + "=7"
dfs(0,S,0)
print(ans)

Measured memory_bytes: 3064
#![allow(dead_code, unused_imports, deprecated)]
use std::cmp::{max, min, Reverse};
use std::collections::*;
use maplit::*;
use num::Integer;
use proconio::input;
use proconio::marker::*;
use proconio::fastout;

const INF : usize = 1000000007;

fn main() {
  input! {
    _ : usize,
    c : String,
  };

  let r = c
    .as_str()
    .chars()
    .filter(|ch| *ch == 'R')
    .count();
  let res = c[0..r]
    .chars()
    .filter(|ch| *ch != 'R')
    .count();
  println!("{}", res);
}

Measured memory_bytes: 2452
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int dp[2][10010][2];
int cost[10010];
int main()
{
	int n;
	cin >> n;
	for(int i=1;i<=n-1;i++)
	{
		cin >> cost[i];
	}
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<10010;j++)
		{
			for(int k=0;k<2;k++)
			{
				dp[i][j][k]=INF;
			}
		}
	}
	dp[1][1][0]=dp[1][0][1]=0;
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			dp[(i+1)%2][j+1][0]=min(dp[i%2][j][0],dp[i%2][j][1]+cost[i]);
			dp[(i+1)%2][j][1]=min(dp[i%2][j][1],dp[i%2][j][0]+cost[i]);
		}
	}
	cout << dp[(n-2)%2][n/2][0] << endl;
	return 0;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  int n,m;
  vector<pair<int,int>> v;
  cin>>n>>m;
  REP(i,m){
    int a,b;
    cin>>a>>b;
    P p;
    p.first = b;
    p.second = a;
    v.pb(p);
  }

  VSORT(v);

  int maxa = 0;
  int count = 0;

  REP(i,m){
    if(v[i].second>maxa){
      count++;
      maxa = v[i].first-1;
    }
  }

  cout<<count<<endl;

  return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 100000002;

int main(){
	int r; cin >> r;
	double pi = 3.1415926535;
	cout << pi * r * 2 << endl;
}

Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#define SIZE 100
using namespace std;

void showlist(int A[], const int N){
    for (int i = 0; i < N - 1; i++){
        cout << A[i] << ' ' ;
    }
    cout << A[N-1] << endl;
}

int* insertionSort(int A[], const int N){
    for (int i = 0; i < N; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        showlist(A, N);
    }
    return A;
}

int main(int argc, char const *argv[]) {
    //標準入力を配列に入れる
    int N;
    cin >> N;
    int A[SIZE];
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    insertionSort(A, N);
    return 0;
}



Measured memory_bytes: 3100
macro_rules! input {
    // ?
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };

    // stdinの生成 値の読み込み開始
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    // ?
    ($next:expr) => {};
    // ?
    ($next:expr, ) => {};

    // 変数名:型の読み込みの繰り返し
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    // 値を読み込むベース 型,の繰り返し
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    // 配列の読み込み
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    // 文字列Vec<char>の読み込み
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    // usize1?の読み込み
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    // 指定した型で読み込み
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        nums: [usize;2],
    };

    println!("{}", solve(nums[0], nums[1]));
}

fn solve(a: usize, b: usize) -> &'static str{
    return if a * b % 2 == 1 {
        "Yes"
    } else {
        "No"
    };
}

macro_rules! tests {
    ($($name:ident:[$( $args:expr ),*] => $output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output,super::solve($($args),*));
                }
            )*
        }
    }
}


tests! {
    //テスト名:[引数]=>expected
    test1:[1,1]=>"Yes",
    test2:[1,2]=>"No",
    test3:[1,3]=>"Yes",
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
using namespace std;

struct pageinfo{
	string nextpage;
	int x1,x2,y1,y2;
	bool inside(int x, int y){
		return (x1<=x && x<=x2 && y1<=y && y<=y2);
	}
};
struct pages{
	vector<struct pageinfo> v_pages;
	string click(int x, int y){
		for(int i=0; i<v_pages.size(); i++){
			if( v_pages[i].inside(x,y) )return v_pages[i].nextpage;
		}
		return "";
	}
};

int main()
{
	int W,H,n;
	while(cin>>n,n){
		map<string,struct pages> mp;
		vector<string> buf;
		cin >> W >> H;
		for(int i=0; i<n; i++){
			string name;
			struct pages ps;
			int k;
			cin >> name >> k;
			if( i==0 )buf.push_back( name );
			for(int j=0; j<k; j++){
				struct pageinfo p;
				cin >> p.x1 >> p.y1 >> p.x2 >> p.y2 >> p.nextpage;
				ps.v_pages.push_back( p );
			}
			mp[name] = ps;
		}
		
		int pos = 0;
		int m;
		cin>>m;
		cin.ignore();
		while(m--){
			string inp;
			getline(cin,inp);
			//printf("pos:%d\n",pos);
			if( inp=="show" ){
				cout << buf[pos] << endl;
			}else if( inp=="back" ){
				if( pos-1 >= 0 )pos--;
			}else if( inp=="forward" ){
				if( pos+1 <  buf.size() )pos++;
			}else{
				char c[8];
				int x,y;
				string ne;
				sscanf(inp.c_str(),"%s %d %d",c,&x,&y);
				ne = mp[buf[pos]].click(x,y);
				if( ne!="" ){
					buf.resize( pos+1 );
					buf.push_back( ne );
					pos++;
				}
			}
		}
	}
	return 0;
}

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

int n,x,y,z;

//aとbとの距離を求める。a<b
// int kyori(int a,int b){
//     if(b<=x||a>=y) return b-a;
//     if(x<=a){
//         if(y<=b) return (x-a)+min(b-x,z-(b-x));
//         else return (x-a)+1+(b-y);
//     }
//     else{
//         if(y<=b) return min(y-x,z-(y-x));
//         if(y>b) return y-b+min(y-a,z-(y-a));
//     }    
//     return 0;
// }

int kyori(int a,int b){
    if(b<=x||a>=y) return b-a;
    if(a<=x){
        if(b<=y)
        return x-a+min(b-x,z-(b-x));
        else return (x-a)+1+(b-y);
    }
    else{
        if(b<=y) return min((b-a),(z-(b-a)));
        else return b-y+min((y-a),(z-(y-a)));
    }    
    return 0;
}

int main(){
    cin>>n>>x>>y;
    z=y-x+1;//ループの長さ
    vector<int> m(n,0);//<距離、個数>
    
    for(int i=1;i<n+1;i++){
        for(int j=i+1;j<n+1;j++){
            int r=kyori(i,j);
            m.at(r)++;
        }
    }
    for(int i=1;i<n;i++){
        cout<<m.at(i)<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
using namespace std;

int main()
{
	short N;
	cin >> N;

	vector<short> X(N);
	int centerHome = 0;//家の座標の中心

	for (short i = 0; i < N; i++) {
		cin >> X[i];
		centerHome += X[i];
	}

	centerHome /= N;//家の座標中心
	int centerHome2 = centerHome + 1;

	int usekcal = 0, usekcal2 = 0;

	//消費体力計算
	for (short i = 0; i < N; i++) {
		int homeKcal = pow((X[i] - centerHome), 2);
		usekcal += homeKcal;

		int homeKcal2 = pow((X[i] - centerHome2), 2);
		usekcal2 += homeKcal2;
	}

	cout << min(usekcal,usekcal2) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>

#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORN(i, a, b) for (int i = a; i <= b; i++)
#define P(s) cout << s << endl
#define PC(condition, _true, _false) if (condition) _true; else _false;
#define toInt(_char) _char - '0'

using namespace std;
//
// Created by karayuu on 2019-3-28.
//

/**
 * 与えられたcharを大文字小文字反転させます.
 * もし,与えられたcharが英文字でなかった場合そのまま返します.
 * @param _char 反転させたいchar
 * @return
 * 英文字のとき,反転後のchar(大文字->小文字,小文字->大文字)
 * 英文字ではないとき,与えられたchar
 */
char toReserveCase(char _char) {
    if ('a' <= _char && _char <= 'z') {
        //小文字の時
        return (char) toupper(_char);
    } else if ('A' <= _char && _char <= 'Z') {
        //大文字の時
        return (char) tolower(_char);
    } else {
        return _char;
    }
}

int main() {
    string s;
    //まとめて1行で読み込む.
    getline(cin, s);

    string n = s;
    transform(s.begin(), s.end(), n.begin(), toReserveCase);

    cout << n << endl;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int n;
	cin >> n;
	
	vector<int>x (n,0);
	
	for(int i = 0; i < n; i++) {
		cin >> x.at(i);
	}
	
	sort(x.begin(), x.end());
	
	int min = x.at(0);
	int max = x.at(n-1);
	
	long long ans = LLONG_MAX;
	long long tmp = 0;
	bool not_over = true;
	int point = min;
	
	while(not_over){
		tmp = 0;
		for(int i = 0; i < n; i++) {
			tmp += (x.at(i)-point)*(x.at(i)-point);
		}
		
		//cout << "dbg,point:" << point << ", tmp:" << tmp << endl;
		
		if (tmp > ans) {
			not_over = false;
			cout << ans << endl;
			return 0;
		}
		if (point++>max) not_over = false;
		ans = tmp;
	}
	
	cout << point-1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int h = int.Parse(input[0]);
		int a = int.Parse(input[1]);
		long answer = 0;

    while(true)
    {
      answer++;
      h -= a;
      if(h <= 0) break;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 11092
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <numeric>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n; cin >> n;
  vector<ll> pos, neg;
  ll pos_sum = 0, neg_sum = 0;
  REP(i,n){
    ll a; cin >> a;
    if(a<0){
      neg.push_back(a);
      neg_sum += a;
    }else{
      pos.push_back(a);
      pos_sum += a;
    }
  }
  sort(pos.begin(),pos.end());
  sort(neg.begin(),neg.end(),greater<ll>());
  ll ans = 0;
  if(neg.size()%2==0){
    ans = pos_sum - neg_sum;
  }else if(pos.empty()){
    ans = -neg_sum+2LL*neg.front();
  }else if(neg.empty()){
    ans = pos_sum;
  }else{
    ans = max(pos_sum-neg_sum+2LL*neg.front(),pos_sum-neg_sum-2LL*pos.front());
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1656
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

xyz = []

for ia in range(len(a)):
    for ib in range(len(b)):
        for ic in range(len(c)):
            if (ia+1)*(ib+1)*(ic+1) <= k:
                xyz.append(a[ia]+b[ib]+c[ic])
            else:
                break

xyz.sort(reverse=True)
for l in xyz[:k]:
    print(l)


Measured memory_bytes: 8708