akhauriyash/Code-Regression huggingface dataset:
k, n = map(int,input().split())
a = list(map(int,input().split()))

b = a
c = []
for i,v in enumerate(b):
    if i <= len(b)-2:
        c.append(b[i+1] - b[i])
    else: #最後は0番目との距離
        c.append(k-b[i]+b[0])

maxwidth = max(c)
print(k - maxwidth)

Measured memory_bytes: 25836
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,K;
  cin>>N>>K;
  int max=N-K+1;
  int min=1;
  if(K!=1){
    cout<<max-min<<endl;
  }else{
    cout<<0<<endl;
  }
}


Measured memory_bytes: 256
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	int a, b, c;
	cin >> a >> b >> c;
	if (a == b) {
		cout << c << endl;
	}
	else if (a == c) {
		cout << b << endl;
	}
	else {
		cout << a << endl;
	}

	return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
template<typename V> typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

int f(string s) {
  int c = 0, p = 0;
  rep(i, s.size()) {
    if (s[i] == 'm') (c += p ? 1000 * p : 1000), p = 0;
    if (s[i] == 'c') (c += p ? 100 * p : 100), p   = 0;
    if (s[i] == 'x') (c += p ? 10 * p : 10), p     = 0;
    if (s[i] == 'i') (c += p ? p : 1), p           = 0;
    if ('2' <= s[i] && s[i] <= '9') p = s[i] - '0';
  }
  return c;
}

string g(int x) {
  stringstream ss;
  if (x >= 2000) (ss << x / 1000 << 'm'), x %= 1000;
  if (x >= 1000) (ss << 'm'), x %= 1000;
  if (x >= 200) (ss << x / 100 << 'c'), x %= 100;
  if (x >= 100) (ss << 'c'), x %= 100;
  if (x >= 20) (ss << x / 10 << 'x'), x %= 10;
  if (x >= 10) (ss << 'x'), x %= 10;
  if (x >= 2) (ss << x << 'i'), x = 0;
  if (x == 1) ss << 'i';
  return ss.str();
}

void solve() {
  int n;
  cin >> n;
  rep(i, n) {
    string s, t;
    cin >> s >> t;
    cout << g(f(s) + f(t)) << endl;
  }
}

Measured memory_bytes: 3036
n, k = map(int, input().split())
s = input()

ln, rn = 0, 0

i = 0
while i < n:
    if s[i] == 'R':
        while i < n and s[i] == 'R':
            i += 1
        rn += 1
    if i < n and s[i] == 'L':
        while i < n and s[i] == 'L':
            i += 1
        ln += 1
m = min(ln, rn)
if m > k:
    if ln == rn:
        print(n - 2 * (m - k))
    else:
        print(n - 2 * (m - k) - 1)
else:
    print(n - 1)

Measured memory_bytes: 69992
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> inline T pow2_L(T a){
  return a*a;
}
int N;
int D;
int X[10][10];
int iss(int s){
  int i, k=sqrt(s);
  for(i=k-1;i<k+2;i++){
    if(i*i==s){
      return 1;
    }
  }
  return 0;
}
int main(){
  int i, j, k, res=0, s;
  rd(N);
  rd(D);
  for(i=0;i<N;i++){
    {
      int Lj4PdHRW;
      for(Lj4PdHRW=0;Lj4PdHRW<D;Lj4PdHRW++){
        rd(X[i][Lj4PdHRW]);
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      s = 0;
      for(k=0;k<D;k++){
        s +=pow2_L((X[i][k]-X[j][k]));
      }
      res += iss(s);
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190708-1

// --- original code ---
// int N, D;
// int X[10][10];
// 
// int iss(int s){
//   int i, k = sqrt(s);
//   rep(i,k-1,k+2) if(i*i==s) return 1;
//   return 0;
// }
// 
// {
//   int i, j, k, s;
//   int res = 0;
//   rd(N,D);
//   rep(i,N) rd(X[i](D));
// 
//   rep(i,N) rep(j,i+1,N){
//     s = 0;
//     rep(k,D) s += (X[i][k]-X[j][k])**2;
//     res += iss(s);
//   }
// 
//   wt(res);
// }


Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
import numpy as np
num=[a,b,c,d,e]
resi=[i%10 if i%10 != 0 else 10 for i in num ]
x=np.argsort(resi)
minnum=num[x[0]]
del(num[x[0]])
sumnum=sum([((i//10)+1)*10 if i%10 !=0 else i for i in num])
res=sumnum+minnum
print(res)

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

int main() {
	int x,y; cin >> x >> y;
	bool flag = false;
	if(y >= (x*2) && y <= (x*4))
	{
	    int b = y-(x*2);
	    if(b%2 == 0 && b/2 >= 0 && b/2 <= x)
	    {flag = false;}
	    else
	    {flag = true;}
	}
	else
	{
	    flag = true;
	}
	if(flag) cout << "No";
	else cout << "Yes";
	return 0;
}

Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int R[] = new int[n];
		
		for (int i = 0; i < n; i++) {
			R[i]  = scan.nextInt();
		}

		int ans = Integer.MIN_VALUE;
		int max = R[0];
		
		for (int i = 0; i < n - 1; i++) {
			if (max == R[i]) {
				int array[] = new int[n - i - 1];
				System.arraycopy(R, i + 1, array, 0, n - i - 1);
				Arrays.sort(array);
				max = array[array.length-1];
			}
			ans = Math.max(ans, max - R[i]);
		}

		System.out.println(ans);
		scan.close();
	}

}

Measured memory_bytes: 107264
#include<iostream>
#include <string>
//#include <algorithm>　//ソート
//#include <set>
using namespace std;
int main()
{
  string s;
    cin >> s;

  if(s[0]=='S')
    cout << "Cloudy" << endl;
  else if(s[0]=='C')
    cout << "Rainy" << endl;
  else
    cout << "Sunny" << endl;

    //s.length(); //長さ
    //s.substr(i, k); //i番目以降k文字を抽出して得られる文字列
    //s.find(t);  //sの中に文字列tがあればその先頭のアドレスを返す．なければs.nopsを返却
    //s.replace(i, k, t); //i番目以降k文字を文字列tで置換する．tを空文字列にすれば削除の動作
    //s.insert(i, t); //i番目の文字の前に文字列tを挿入

    //sort(a.begin(), a.end(),);  //昇順ソート
    //sort(a.begin(), a.end(), greater<int>());   //降順ソート
    //swap(a, b); //値を交換する
    //min(a, b);  //小さい方
    //max(a, b);  //大きい方

    //binary_search(vc.begin(), vc.end(), x); //trueかfalseを返す
    //lower_bound(vc.begin(), vc.end(), x);   //x以上の値が初めて現れる位置のイテレータを返す
    //upper_bound(vc.begin(), vc.end(), x);   //xより大きい値が初めて現れる位置のイテレータを返す




    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String s = "";
        s += n;
        int sum = 0;

        for (int i = 0; i<s.length(); i++){
            sum += Integer.parseInt(String.valueOf(s.charAt(i)));
        }
        if (n%sum == 0)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 39020
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int A[200200], B[200200];
int N;
int ans[30];

signed main() {
    cin >> N;
    rep(i, N) {
        cin >> A[i];
    }
    rep(i, N) {
        cin >> B[i];
    }
    int an = 0;
    for (int k = 29; k >= 0; --k) {
        rep(i, N) {
            A[i] %= 1 << (k + 1);
            B[i] %= 1 << (k + 1);
        }
        sort(B, B + N);
        int T = 1 << k;
        //a_i+b_j=[T,2T),[3T,4T)
        rep(i, N) {
            int a = A[i];
            //b_j=[T-a,2T-a),[3T-a,4T-a)
            ans[k] += l_b(B, B + N, 2 * T - a) - l_b(B, B + N, T - a);
            ans[k] += l_b(B, B + N, 4 * T - a) - l_b(B, B + N, 3 * T - a);
            ans[k] %= 2;
        }
        an = an * 2 + ans[k];
    }
    cout << an << endl;
    return 0;
}


Measured memory_bytes: 3456
#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
#ifndef CrafterKolyan
#define endl '\n'
#endif

int a[200000];
ll sum[200001];

signed main() {
#ifndef CrafterKolyan
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    ll l = 1, r = 3;
    ll ans = LLONG_MAX;
    for (ll m = 2; m < n; ++m) {
        r = max(r, m + 1);

        while (l + 1 < m && abs(sum[m] - 2 * sum[l]) >= abs(sum[m] - 2 * sum[l + 1])) ++l;
        while (r + 1 < n && abs(sum[n] - 2 * sum[r] + sum[m]) >= abs(sum[n] - 2 * sum[r + 1] + sum[m])) ++r;
        ll a[4] = {
            sum[l],
            sum[m] - sum[l],
            sum[r] - sum[m],
            sum[n] - sum[r]
        };
        sort(a, a + 4);
        ans = min(ans, a[3] - a[0]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const SP = arg.slice(1, N + 1);
    
    let list = [];
    
    for(let i in SP) {
        const S = SP[i].split(" ")[0];
        const P = SP[i].split(" ")[1];
        
        const temp = {name: S, point: P, originIdx: i};
        
        list.push(temp);
    }
    
    list.sort((a,b)=>{
        if(a.name < b.name) {
            return -1;
        }
        
        if(a.name > b.name) {
            return 1;
        }
        
        if(a.point - b.point > 0) {
            return -1;
        }
        
        if(a.point - b.point < 0) {
            return 1;
        }
        
        return 0;
    });
    
    // list.sort((a,b)=>a.name < b.name);
    // console.log(JSON.stringify(list));
    
    let answer = [];
    
    for(let i in list) {
        answer.push(parseInt(list[i].originIdx) + 1);
    }
    
    console.log(answer.join("\n"));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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



int main() {
	long long int A, B;
	cin >> A >> B;
	if(A>=13) {
		cout << B << endl;
	} else if(A <= 5) {
		cout << 0 << endl;
	} else {
		cout << B / 2 << endl;
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int a,b; 
	cin >> a >> b;
	if((a+b)%2 == 0){
		cout << (a+b)/2 << endl;
    }else{
		cout << (a+b+1)/2 << endl;
    }
}


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

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

int H, W;
vector<string> field;

bool seen[20][20];
int  dist[20][20];

void bfs(int h, int w) {
    seen[h][w] = true;
    dist[h][w] = 0;
    
    queue<int> q_x;
    queue<int> q_y;
    
    q_x.push(w);
    q_y.push(h);
    
    while(1) {
        w = q_x.front();
        h = q_y.front();
        q_x.pop();
        q_y.pop();
        
        for (int dir = 0; dir < 4; ++dir) {
            
            int nh = h + dx[dir];
            int nw = w + dy[dir];

            if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
            if (field[nh][nw] == '#') continue;
    
            if (seen[nh][nw]) continue;

            if(dist[nh][nw] == -1) {
                dist[nh][nw] = dist[h][w] + 1;
            }
            
            q_x.push(nw);
            q_y.push(nh);
            seen[nh][nw] = true;

        }
        if(q_x.empty()) break;
    }

}

int main(void){

    cin >> H >> W;
    field.resize(H);
    for (int h = 0; h < H; ++h) cin >> field[h];

    int max_dist = 0;
    for(int h=0; h<H; h++) {
        for(int w=0; w<W; w++) {
            if(field[h][w] != '#') {
                memset(seen, 0, sizeof(seen));
                memset(dist, -1, sizeof(dist));
                bfs(h, w);
            }
            for(int hh=0; hh<H; hh++) {
                for(int ww=0; ww<W; ww++) {
                    if(dist[hh][ww] > max_dist) {
                        max_dist = dist[hh][ww];
                    }
                }
            }
        }
    }

    cout << max_dist << endl;


    return 0;
}


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

// @author: pashka

int gcd(int a, int b) {
    while (b > 0) {
        int c = a % b;
        a = b;
        b = c;
    }
    return a;
}

map<pair<int, int>, int> mem;

int get(int x, int y) {
    x = abs(x);
    y = abs(y);
    return gcd(x, y);
//    typedef typename map<pair<int, int>, int>::mapped_type V;
//    auto r = mem.insert({{x, y}, V()});
//    V &v=r.first->second;
//    if (r.second)
//        v = gcd(x, y);
//    return v;
}

long calc(long w, long h, long k) {
    long res = 0;
    vector<int> mem(h + 1);
    vector<int> t2(h + 1);
    vector<int> mem2(h + 1);
    for (long b = 1; b < w; b++) {
        for (long c = 1; c < h && c * w <= 2 * (k + w); c++) {
            int mm = get(c, b);
//            c * w + (a - c) * b <= 2k;
            long mina = max((2 * k - c * w) / b + c, c);
            mina = min(mina, h);
            if (mina > c) {
                res += (mina - c) * 2 - 1;
            }
            for (long a = mina; a < h && c * w + (a - c) * b <= 2 * (k + w); a++) {
                long s = c * w + (a - c) * b;
                if (s / 2 <= k) {
                    res++;
                    if (a != c) res++;
                    continue;
                }
                long g = mm;
                if ((s - g + 2) / 2 <= k) {
                    res++;
                    if (a != c) res++;
                    continue;
                }
                if (t2[a] != b) {
                    t2[a] = b;
                    mem2[a] = get(a, w - b);
                }
                g += mem2[a];
                if ((s - g + 2) / 2 <= k) {
                    res++;
                    if (a != c) res++;
                    continue;
                }
                if (mem[a - c] == 0) {
                    mem[a - c] = get(a - c, w);
                }
                g += mem[a - c];
                if ((s - g + 2) / 2 <= k) {
                    res++;
                    if (a != c) res++;
                    continue;
                }
            }
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);

    int w, h, k;
    cin >> w >> h >> k;
    auto start = std::chrono::high_resolution_clock::now();
    cout << (calc(w, h, k) + calc(h, w, k)) * 2;
    auto finish = std::chrono::high_resolution_clock::now();

    std::chrono::duration<double> elapsed = finish - start;
    cerr << elapsed.count() << "\n";

    return 0;
}


Measured memory_bytes: 4576
n,m=map(int,input().split())
ship = [[int(i) for i in input().split()] for i in range(m)]
mid_first=[]    # 1本目の定期便の目的地
mid_last=[]     # 2本目の定期便の目的地

for s,e in ship:
    if s==1:
        mid_first.append(e)
    if e==n:
        mid_last.append(s)
print("POSSIBLE" if len(set(mid_first) & set(mid_last))>0 else "IMPOSSIBLE")

Measured memory_bytes: 48580
#include<bits/stdc++.h>
using namespace std;
void sik(int);
int gr[7][7];
int ch[7];
int co[7];
int main(){
  while(1){
    //
    for(int i=0;i<7;i++){
      for(int j=0;j<7;j++){
	gr[i][j]=0;
	ch[i]=-1;
	co[i]=0;
      }
    }
    int f=0;
    //
    int n;
    cin >> n;
    if(cin.eof())break;
    int st;
    for(int i=0;i<n;i++){
      int bu;
      cin >> bu;
      gr[bu/10][bu%10]=1;
      gr[bu%10][bu/10]=1;
      ch[bu%10]=0;
      ch[bu/10]=0;
      co[bu/10]++;
      co[bu%10]++;
      st=bu%10;
    }
    int cok=0;
    for(int i=0;i<7;i++){
      if(co[i]%2)cok++;
    }
    if(cok>2)f=1;
    sik(st);
    for(int i=0;i<7;i++){
      // cout << ch[i] << endl;
      if(ch[i]==0)f=1;      
    }
    if(f)cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  return 0;
}
void sik(int a){
  for(int i=0;i<7;i++){
    if(gr[a][i]){
      if(ch[i])continue;
      else{
	ch[i]=1;
	sik(i);
      }

    }
  }
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e4;
const ll inf = 1e9+7;



int main() {
	fastio;
	
	ll n,d,cont=0;
	cin>>n>>d;
	f(i,0,n){
		ll x, y;
		cin>>x>>y;
		if(d*d >= x*x+y*y) cont++;
	}
	cout<<cont<<endl;
	return 0;
}

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

int main()
{
	long long a,k1,b,k2,t;
	cin>>a>>k1>>b>>k2>>t;
	if(a<b)
	{
		long long cnt1=k1*t+a;
		long long cnt2=k2*t+b;
		if(cnt1>=cnt2)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	else
	{
		long long cnt1=a-k1*t;
		long long cnt2=b-k2*t;
		if(cnt1<=cnt2)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}

	return 0;
}

Measured memory_bytes: 3632
//AtCoder ABC106 C - To Infinity
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main() {
    string S;
    ll K; cin>>S>>K;
    char ans='1';
    for(ll i=0;i<K;++i){
        if (S[i]!='1'){
            ans=S[i];
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    string a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    int count = 0;
    rep(i, n) {
        if(a[i] != b[i]) {
            if(a[i] == c[i]) count++;
            else if(b[i] == c[i]) count++;
            else count += 2;
        }
        else {
            if(a[i] != c[i]) count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
S = list(input())
l = len(S)
ans = 0
for i in range(l - 1):
  if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
    L = 1
    for j in range(i + 1, l):
      if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
        L += 1
      else:
        ans = max(ans, L)
        i = j
        break
    ans = max(ans, L)
if S[l - 1] == "A" or S[l - 1] == "T" or S[l - 1] == "G" or S[l - 1] == "C":
  L = 1
  ans = max(ans, L)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)

int main(){
    vector<vector<int>> c(3,vector<int>(3));
    rep(i, 0, 3) rep(j, 0, 3) cin >> c[i][j];
    
    vector<int> d(6);
    int k = 0;
    rep(i, 0, 3){
        rep(j, 0, 2){
            d[k] = c[i][j] - c[i][j + 1];
            k++; 
        }
    }
    // int d1 = c[0][0] - c[0][1], d2 = c[0][1] - c[0][2];
    // int d3 = c[1][0] - c[1][1], d4 = c[1][1] - c[1][2];
    // int d5 = c[2][0] - c[2][1], d6 = c[2][1] - c[2][2];

    if(d[0] == d[2] && d[2] == d[4] && d[1] == d[3] && d[3] == d[5])
    // if(d1 == d3 && d3 == d5 && d2 == d4 && d4 == d6)
    cout << "Yes" << endl;
    else 
    cout << "No" << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] P = new int[N];
    int count = 1;
    for(int i =0; i<N; i++){
      	P[i] = sc.nextInt();
    }
    int min = P[0];
    
    for(int i = 1; i<N; i++){
      if(P[i] < min){
        count++;
        min = P[i];
      }

    } 
    System.out.println(count);
  }
}

Measured memory_bytes: 65888
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

int H, W;
char map[20][20];
int dist_value;
int dist[20][20];
struct coord  {
  int x;
  int y;
};


int drow[4]={1,-1,0,0};
int dcolumn[4]={0,0,1,-1};
std::queue<coord > queue;
coord last;


void initdist(){
  dist_value = 0;
  // queueをまず空にする
  std::queue<coord > empty;
  std::swap(queue, empty);
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      dist[i][j] = -1;
    }
  }
  return;
}

void bfs(int start_i, int start_j){
  //printf("bfs called\n");
  queue.push((coord){start_i,start_j});
  queue.push((coord){-1,-1});
  dist_value = 0;
  while (queue.size()>1){ // 番兵のみ(size=1)になったら終了
    //std::cout << "queue.size()="<<queue.size() << std::endl;
    while(queue.front().x!=-1 && queue.front().y!=-1){ // 番兵に達するまで処理を続ける
      int thisi = queue.front().x;
      int thisj = queue.front().y;
      last.x = thisi;
      last.y = thisj;
      queue.pop();
      dist[thisi][thisj]=dist_value;
      for(int k=0; k<4; k++){
        if (thisi+drow[k]>=0 && thisi+drow[k]<H && thisj+dcolumn[k]>=0 && thisj+dcolumn[k]<W){
          if (dist[thisi+drow[k]][thisj+dcolumn[k]]==-1 && map[thisi+drow[k]][thisj+dcolumn[k]]!='#'){
            queue.push((coord){thisi+drow[k], thisj+dcolumn[k]});
            dist[thisi+drow[k]][thisj+dcolumn[k]] = -2;
          }
        }
      }
    }
    //std::cout << "queue.size at L 63="<<queue.size() << std::endl;
    //先頭にたまっている番兵を全て捨てる(複数の番兵が溜まっていることがあることに注意)
    if(queue.size()>0 && queue.front().x==-1 && queue.front().y==-1){
      queue.pop();
      //std::cout << "queue.size at L 67="<<queue.size() << std::endl;
      //std::cout << "front value = " << queue.front().x << "," << queue.front().y << std::endl;
    }
    //std::cout << "queue.size at L 68="<<queue.size() << std::endl;
    queue.push((coord){-1,-1}); //末尾に番兵を追加
    dist_value++;
  }
  return;
}


int maxdist(){
  int ans = 0;
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      if (map[i][j]=='#'){
        continue;
      }
      initdist();
      bfs(i,j);
      ans = std::max(ans,dist_value-1);
    }
  }
  return ans;
}

int main(){
  scanf("%d",&H);
  scanf("%d",&W);
  std::string S;
  
  for (int i=0; i<H; i++){
    std::cin >> S;
    for (int j=0; j<W; j++){
      map[i][j] = S[j];
    }
  }
  int ans = maxdist();
  printf("%d\n",ans);

  return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
ans=0
mod=10**9+7
b=[0]+[i for i in range(n+1)]
for i in range(1,n+2):
    b[i]+=b[i-1]

for i in range(k,n+2):
    ans+=b[n+1]-b[n-i+1]-b[i]+1
    ans%=mod
print(ans)

Measured memory_bytes: 19364
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map { it.toLong() }.toMutableList()
    val b = readLine()!!.split(' ').map { it.toLong() }.toMutableList()
    var ans = 0L
    for (i in 0 until n) {
        val add1 = Math.min(a[i], b[i])
        val add2 = Math.min(b[i] - add1, a[i + 1])
        a[i] -= add1
        a[i + 1] -= add2
        ans += add1 + add2
    }
    println(ans)
}

Measured memory_bytes: 82352
s = list(input())
cnt = 0
for i in range(len(s) - 1):
    if s[i] == s[i+1]:
        if s[i+1] == "0":
            s[i+1] = "1"
        elif s[i+1] == "1":
            s[i+1] = "0"
        cnt += 1
print(cnt) 

Measured memory_bytes: 3956
def main():
    n = int(input())
    hts = list(map(int,input().split()))
    hts[0] -= 1
    for i in range(1,n):
        if hts[i] > hts[i-1]:
            hts[i] -= 1

    for i in range(1,n):
        if hts[i] < hts[i-1]:
            print('No')
            return

    print('Yes')


main()


Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
#define debug(x) cerr << #x << ":" << x << endl;

int main()
{
  int64 N, x;
  cin >> N >> x;
  vector< int64 > a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    // debug(a[i]);
  }

  int64 ans = 1e18 + 1ll;
  vector< int64 > memo(a);
  
  for (int64 i = 0ll; i < N; ++i) {
    int64 sm = x * i;
    
    for (int64 j = 0ll; j < N; ++j) {
      // debug(j);
      // debug(a[j]);
      // debug(a[(N + j - i) % N]);
      memo[j] = min(memo[j], a[(N + j - i) % N]);
      sm += memo[j];
    }

    ans = min(ans, sm);
    // cout << ans << endl << endl;
  }

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


Measured memory_bytes: 256
H,W,D = map(int,input().split())
A = list(list(map(int,input().split()))for i in range(H))
B = [[0,0]for i in range(H*W)]
for i in range(H):
    for j in range(W):
        B[A[i][j]-1] = [i,j]
MP = [0]*(H*W)
for i in range(D):
    x,y = B[i]
    for j in range(i+D,H*W,D):
        MP[j] = MP[j-D] + abs(x-B[j][0]) + abs(y-B[j][1])
        x,y = B[j]
for i in range(int(input())):
    l,r = map(int,input().split())
    print(MP[r-1]-MP[l-1])

Measured memory_bytes: 22364
import sys
input = sys.stdin.buffer.readline


class Segtree():
    def __init__(self, N):
        # N:  処理する区間の長さ
        self.N0 = 2**(N-1).bit_length()
        self.INF = 2**31-1
        self.seg_min = [self.INF]*(2*self.N0)

    def update(self, index, value):
        index += self.N0 - 1
        self.seg_min[index] = value
        while index > 0:
            index = (index - 1) // 2
            self.seg_min[index] = min(self.seg_min[index * 2 + 1], self.seg_min[index * 2 + 2])

    def query(self, first, last):
        first += self.N0 - 1
        last += self.N0 - 1
        ret = self.INF
        while first <= last:
            if not first & 1:
                ret = min(ret, self.seg_min[first])
            if last & 1:
                ret = min(ret, self.seg_min[last])
            first = first // 2
            last = last // 2 - 1
        return ret


N = int(input())
prob = []
max_len = 0
max_len_pair = []
for _ in range(N):
    L, R = map(int, input().split())
    if max_len < R - L + 1:
        max_len = R - L + 1
        max_len_pair = [(L, R)]
    elif max_len == R - L + 1:
        max_len_pair.append((L, R))
    prob.append((L, R))
prob.sort(key=lambda x: x[1])
prob.sort(key=lambda x: x[0])

segtree_L = Segtree(N)
segtree_R = Segtree(N)
for i in range(N):
    segtree_L.update(i, -prob[i][0])
    segtree_R.update(i, prob[i][1])

ans_best = 0
for i in range(N-1):
    ans1 = max(segtree_R.query(0, i) + segtree_L.query(0, i) + 1, 0)
    ans2 = max(segtree_R.query(i+1, N-1) + segtree_L.query(i+1, N-1) + 1, 0)
    ans_best = max(ans_best, ans1+ans2)

max_len_pair.sort(key=lambda x: x[0])
ans_another1 = max_len
ans_another2 = max_len
flg = 0
for i in range(N):
    if prob[i] == max_len_pair[0]:
        idx = i
        flg += 1
    if prob[i] == max_len_pair[-1]:
        idx2 = i
        flg += 1
    if flg == 2:
        break

Lmax1 = 0
Rmin1 = 10**9+1
Lmax2 = 0
Rmin2 = 10**9+1
for i in range(N):
    if i != idx:
        Lmax1 = max(Lmax1, prob[i][0])
        Rmin1 = min(Rmin1, prob[i][1])
    if i != idx2:
        Lmax2 = max(Lmax2, prob[i][0])
        Rmin2 = min(Rmin2, prob[i][1])
ans_another1 += max(0, Rmin1 - Lmax1 + 1)
ans_another2 += max(0, Rmin2 - Lmax2 + 1)

print(max(ans_best, ans_another1, ans_another2))


Measured memory_bytes: 76764
using System;

namespace Main
{
  class Program
  {
    static void Main(string[] args)
    {
      var lines = Console.ReadLine().Split(' ');
      var a = int.Parse(lines[0]);
      var b = int.Parse(lines[1]);
      var k = int.Parse(lines[2]);

      for (var i = a; i <= b; i++)
        if(a <= i && i < a+k || b-k < i && i<=b )
          Console.WriteLine(i);
    }
  }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

inline auto fa (size_t n)
{
  size_t res = 1;
  while (res < n) res <<= 1;
  return res;
}

template <typename T, typename F>
struct segtree
{
  size_t n;
  vector <T> nodes;
  F f;


  static auto parent (size_t i)
  {
    return i / 2;
  }
  static auto left_child (size_t i)
  {
    return i * 2;
  }
  static auto right_child (size_t i)
  {
    return i * 2 + 1;
  }

  segtree (const vector <T> v, T init, F f_)
    : n {fa (v.size ())}
    , nodes (2 * n, init)
    , f {f_}
  {
    rep (i, v.size ()) nodes[i + n] = v[i];
    for (size_t i = n; i -- > 1;) nodes[i] = f (nodes[left_child (i)], nodes[right_child (i)]);
  }

  auto update (size_t i, T value)
  {
    i += n;
    nodes[i] = move (value);
    for (i = parent (i); i > 0; i = parent (i))
    {
      nodes[i] = f (nodes[left_child (i)], nodes[right_child (i)]);
    }
  }

  auto get_impl(int a, int b, int k, int l, int r)
  {
    if (r <= a || b <= l) return nodes[0];

    if (a <= l && r <= b) return nodes[k];

    auto mid = (l + r) / 2;
    auto lv = get_impl (a, b, left_child (k), l, mid);
    auto rv = get_impl (a, b, right_child (k), mid, r);
    return f (lv, rv);
  }

  auto get (int a, int b)
  {
    return get_impl (a, b, 1, 0, n);
  }
};

template <typename T, typename F>
auto make_segtree (const vector <T> & v, T init, F f)
{
  return segtree <T, F> (v, init, f);
}

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n;
  string s;
  size_t q;
  cin >> n >> s >> q;

  vector <set <char>> aa (n);
  rep (i, n) aa[i].insert (s[i]);

  auto st = make_segtree (aa, set <char> (), [](set <char> l, auto && r){
    for (auto && elem : r) l.insert (elem);
    return l;
  });

  rep (q_, q)
  {
    int t;
    cin >> t;
    if (t == 1)
    {
      size_t i;
      char c;
      cin >> i >> c;
      -- i;
      st.update (i, set <char> {c});
    }
    else
    {
      int l, r;
      cin >> l >> r;
      -- l;
      auto ans = st.get (l, r);
      cout << ans.size () << endl;
    }
  }
}


Measured memory_bytes: 282396
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			String s = sc.next();

			String[] a = new String[s.length()];

			for(int i =0;i<s.length();i++) {
				a[i]=String.valueOf(s.charAt(i));

			}


			long res = 0;
			long b =0;


			for(int i=0;i<s.length();i++) {
				if(a[i].equals("B")) {
					b++;
				}
				if(a[i].equals("W")) {
					res=res+b;
				}


			}

			System.out.println(res);

		}

	}

Measured memory_bytes: 36376
def goalnum( n, amida )
	p = n
	amida.each_with_index{|e,i|
		if p == e[ 0 ]
			p = e[ 1 ]
		elsif p == e[ 1 ]
			p = e[ 0 ]
		end
#		print "#{i}:#{p}\n"
	}
	return p
end


array = Array.new
width = $stdin.gets.chomp.to_i
n = $stdin.gets.chomp.to_i
n.times{
	line = $stdin.gets.chomp
	yokobow = line.split( /,/ )
	yokobow.map!{ |i| i.to_i }
	array << yokobow
}
array.reverse!
1.upto( width ){ |w|
	puts goalnum( w, array )	
}


Measured memory_bytes: 6096
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pi(n,m) n.insert(n.begin(),m);
#define ee(n) n.erase(n.end()-1)
#define eb(n) n.erase(n.begin())
#define check(n) reverse(all(n));rep(z,0,n.size())cout<<n[z];co("");reverse(all(n));
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int a[3];
  rep(i,0,3) cin>>a[i];
  sort(a,a+3);
  co(a[0]+a[1]);
  
  return 0;
}

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

static long long Par[100010], Rank[100010], Size[100010];

void init(int n) {
	for (int i = 0; i < n; i++) {
		Par[i] = i;
		Rank[i] = 0;
		Size[i] = 1;
	}
}

int root(int x) {
	if (Par[x] == x) return x;
	return Par[x] = root(Par[x]);
}

bool same(int x, int y) {
	return root(x) == root(y);
}

void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y) return;
	if (Rank[x] < Rank[y]) {
		Par[x] = y;
		Size[y] += Size[x];
	}
	else {
		Par[y] = x;
		Size[x] += Size[y];
		if (Rank[x] == Rank[y]) Rank[x]++;
	}
}

int main() {
	long long N, M, ans[100010];
	static pair<int, int> P[100010];
	cin >> N >> M;
	ans[M] = N * (N - 1) / 2;
	init(N);
	for (int i = 1; i <= M; i++) {
		int A, B;
		cin >> A >> B;
		A--, B--;
		P[i] = { A, B };
	}
	for (int i = M - 1; i >= 1; i--) {
		int A = P[i + 1].first, B = P[i + 1].second;
		if (same(A, B)) ans[i] = ans[i + 1];
		else {
			ans[i] = ans[i + 1] - Size[root(A)] * Size[root(B)];
			unite(A, B);
		}
	}
	for (int i = 1; i <= M; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 5248
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


int main() {

	string s; cin >> s;

	map<char, int> mp;

	for (int i = 0; i < s.size(); i++) {
		mp[s[i]]++;
	}

	for (auto i : mp) {
		if (i.second % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================
/*
vi g[N];
int a[N];

int main() {
    ios_base::sync_with_stdio(0);
    int t, i, j, k, p, q, r, x, y, u, v, n, m;

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}
*/
int main()
{
	
	int n;
	cin>>n;
	int arr[n+1];
	for(int i = 1;i<=n;i++)
	{
		cin>>arr[i];
	}
	int count = 0;
	for(int i = 1;i<=n;i++)
	{
		if((arr[i]%2!=0 )&& (i%2!=0))
		{
			count++;
		}
	}
	cout<<count<<endl;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std; 
int n;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
long long ans;
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	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),c);
	}
	cout<<ans<<endl;
    return 0; 
}/*
*/

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  string s;
  cin >> s;
  if (s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba") cout << "Yes";
  else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}




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

  ll N; cin >> N ; 
  vector<pair<ll,ll>  > par;

  ll ans = 1e18;
  rep(i,N){
    ll A, B; cin >> A >> B ;
    ans = min(ans, A+B); 
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdlib>
#include<cmath>
using namespace std;
int main(){
  int N; cin>>N;
  vector<int> S(N); 
  for(int i=0; i<N; i++){
    cin>>S.at(i);
  }
  int V=0;
  for(int i=0; i<N-1; i++){
    for(int j=i+1; j<N; j++){
      V+=S.at(i)*S.at(j);
    }
  }
  cout<<V<<endl;
}


Measured memory_bytes: 3568
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, M;
		N = sc.nextInt();
		M = sc.nextInt();
		Integer L[] = new Integer[M];
		Integer R[] = new Integer[M];

		for (int i = 0; i < M; i++) {
			L[i] = sc.nextInt();
			R[i] = sc.nextInt();
		}
		sc.close();

		Arrays.sort(L, Collections.reverseOrder());
		Arrays.sort(R);
		if (R[0] - L[0] < 0) {
			System.out.println(0);
		} else {
			System.out.println(R[0] - L[0] + 1);
		}
	}
}


Measured memory_bytes: 92456
#include <bits/stdc++.h>
using namespace std;
//cin.sync_with_stdio(false);

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

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;

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

	int a, b, x;
	cin >> a >> b >> x;
	
	if (0 <= x-a && x-a <=b)
	{
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << 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 < (n); ++i)


int main(){
    int N, X, T;
    cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << endl;
}


Measured memory_bytes: 3628
N = int(input())
city={}
city_name=[]
for n in range(N):
    S = input().split()
    city[n+1]=S
    city_name.append(S[0])

city_name=list(set(city_name))
city_name.sort()

for c_name in city_name:
    city_temp = {}
    for c_key in city.keys():
        if city[c_key][0] == c_name:
            city_temp[int(city[c_key][1])]=c_key
            
    p_temp = list(city_temp.keys())
    p_temp.sort(reverse=True)
    for v in p_temp:
        print(city_temp[v])

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





vector<int> manacher(string s) {
    vector<int> r(s.size());
    int c = 0;
    for (int i = 0; i < s.size(); ++i) {
        int l = c - (i - c);
        // cout << r[l] << endl;
        if (i + r[l] < c + r[c]) r[i] = r[l];
        else {
            int j = c + r[c] - i;
            while (i - j >= 0 && i + j < s.size() && s[i - j] == s[i + j]) ++j;
            r[i] = j;
            c = i;
        }
    }
    // rep(i, sz(s)) cout << r[i] << " "; cout << endl;
    return r;
    /*
    int ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        ans = max(ans, r[i]);
    }
    return ans;
     */
}

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    // 長さ2以上
    
    vector<int> r = manacher(s);
    rep3(len, 2, sz(s) + 1) {
        int flg = 0;
        rep3(k, 1, 2000000) {
            int i = (len - 1) * k;
            if (i >= sz(s)) break;
            if (r[i] != min(i + 1, n - i)) {
                flg = 1;
                break;
            }
        }
        if (flg == 0) {
            cout << len << endl;
            return 0;
        }
    }
}



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

int main() {
	int k, s; cin >> k >> s;
	
	int cnt = 0;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			int l = s - i - j;
			if (0 <= l && l <= k)cnt++;
		}
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

namespace rika
{
	template <typename T>
	class edge
	{
	public:
		int to;
		T cost;

		edge() = default;
		edge( const edge<T>& ) = default;
		edge( edge<T> && ) = default;
		edge& operator =( const edge<T>& ) = default;
		edge& operator =( edge<T> && ) = default;

		~edge() = default;

		edge( int _to, T _cost ) : to( _to ), cost( _cost ) {}
	};
}

namespace rika
{
	namespace internal
	{
		template <typename TValue, typename TGraph>
		std::pair<TValue, int> visit( int from, int v, const TGraph &g )
		{
			auto r = std::make_pair( TValue(), v );
			try
			{
				for( auto it = g[v].begin(); it != g[v].end(); ++it )
				{
					if( it->to == from )
						continue;
					auto r2 = visit<TValue>( v, it->to, g );
					if( r2.first + it->cost >= r.first )
						r = std::make_pair( r2.first + it->cost, r2.second );
				}
			}
			catch ( bool x ) {
				printf("hoge\n");
			}
			return r;
		}
	}

	template <typename TValue, typename TGraph>
	TValue tree_diameter( const TGraph &g )
	{
		using namespace internal;
		auto r1 = visit<TValue>( -1, 0, g );
		auto r2 = visit<TValue>( -1, r1.second, g );
		return r2.first;
	}
}

#include<bits/stdc++.h>
using namespace std;
using namespace rika;
int main()
{
	int N;
	cin >> N;
	vector<vector<edge<int>>> g( N * 10 );
	for( int i = 0; i < N - 1; i++ )
	{
		int s, t, w;
		cin >> s >> t >> w;
		g[s].push_back( edge<int>( t, w ) );
		g[t].push_back( edge<int>( s, w ) );
	}
	cout << tree_diameter<int>( g ) << endl;
}

Measured memory_bytes: 35356