akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<double, int> PD;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

struct Piece {
  double gx;
  int xl, xr;
};

int w, h;
string s[60];
int dd[] = {1, 0, -1, 0, 1};
int on[100][100];
bool visited[60][10];
int panel[60][10];
Piece v[100];
bool stable;
double gx;
int num;

bool range(int x, int y) {
  return 0 <= x && x < w && 0 <= y && y < h;
}

void search(int y, int x, char c, int num) {
  panel[y][x] = num;
  visited[y][x] = true;
  v[num].gx += x + 0.5;

  if (y == h - 1) minch(v[num].xl, x), maxch(v[num].xr,x + 1);

  rep(i, 4) {
    int yy = y + dd[i], xx = x + dd[i + 1];
    if (range(xx, yy) && s[yy][xx] == c && !visited[yy][xx]) {
      search(yy, xx, c, num);
    }
  }
}

void on_search(int y, int x, int num) {
  visited[y][x] = true;

  rep(i, 4) {
    int yy = y + dd[i], xx = x + dd[i + 1];
    if (range(xx, yy)) {
      if (i == 2 && panel[yy][xx] != num && panel[yy][xx] >= 0) on[num][panel[yy][xx]] = 1;
      if (i == 0 && panel[yy][xx] != num && panel[yy][xx] >= 0) {
        minch(v[num].xl, x), maxch(v[num].xr, x + 1);
      }
      if (!visited[yy][xx] && panel[yy][xx] == num) on_search(yy, xx, num);
    }
  }
}

void calc(int i, int size) {
  gx += v[i].gx, num++;
  rep(j, size) if (on[i][j]) calc(j, size);
}

bool centerGrabity(int i, int size) {
  gx = num = 0;
  calc(i, size);
  double g = gx / (num * 4);
  return (v[i].xl < g && g < v[i].xr);
}

int main(){
  cin.sync_with_stdio(false);
  while(cin >> w >> h, w | h) {
    rep(i, h) cin >> s[i];
    rep(i, h) rep(j, w) panel[i][j] = -1, visited[i][j] = false;
    rep(i, 100) rep(j, 100) on[i][j] = 0;

    int idx = 0;
    repr(i, h) {
      rep(j, w) {
        if (s[i][j] != '.' && panel[i][j] == -1) {
          Piece p = Piece{0.0, INF, -1};
          v[idx] = p;
          search(i, j, s[i][j], idx);
          idx++;
        }
      }
    }

    rep(i, h)rep(j, w) visited[i][j] = false;
    rep(i, h)rep(j, w) if (s[i][j] != '.' && !visited[i][j]) on_search(i, j, panel[i][j]);

    stable = true;
    rep(i, idx) stable &= centerGrabity(i, idx);
    cout << ((stable) ? "STABLE" : "UNSTABLE") << endl;
  }

  return 0;
}

Measured memory_bytes: 3160
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, m, x; cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  REP(i, n) {
    cin >> c[i];
    REP(j, m) cin >> a[i][j];
  }
  int ans = INF;
  REP(i, 1 << n) {
    int cost = 0;
    vector<int> und(m, 0);
    REP(j, n) {
      if (i >> j & 1) {
        cost += c[j];
        REP(k, m) und[k] += a[j][k];
      }
    }
    if (*min_element(ALL(und)) >= x) chmin(ans, cost);
  }
  cout << (ans == INF ? -1 : ans) << '\n';
  return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>
#include <stdlib.h>
 
int main ()
{
  int n,i;
  long step=0;
  long *a;
 
  scanf("%d",&n);
  a = calloc(n,sizeof(long));
 
  for(i=0; i<n; i++)
    scanf("%ld", &a[i]);
 
  for(i=1; i<n; i++){
    if(a[i] < a[i-1]){
      step += (a[i-1]-a[i]);
      a[i] += (a[i-1]-a[i]);
    }
  }
 
  printf("%ld", step);
  return 0;
}

Measured memory_bytes: 3300
import io.StdIn._
 
object Main extends App {
  val n   = readInt
  val arr = readLine.split(" ").map(_.toInt)
 
  require(1 <= n && n <= 100)
  require(arr.forall(a => 1 <= a && a <= 1000))
 
  if (arr.forall(a => !(a % 2 == 0 && a % 3 != 0 && a % 5 != 0))) println("APPROVED")
  else println("DENIED")
}

Measured memory_bytes: 54676
#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>

long long combination(long long n, long long k){
  long long ans = 1;
  for(int i = 0; i < k; i++){
    ans *= n-i;
    ans /= (i+1);
  }
  return ans;
}

int main(){
  int N, A, B;
  std::cin >> N >> A >> B;

  std::vector<long long> v_arr(N);
  for(int i = 0; i < N; i++) std::cin >> v_arr[i];
  std::sort(v_arr.begin(), v_arr.end());
  int thr_left = N-std::distance(v_arr.begin(), std::upper_bound(v_arr.begin(), v_arr.end(), v_arr[N-A]));
  int thr_right = N-std::distance(v_arr.begin(), std::lower_bound(v_arr.begin(), v_arr.end(), v_arr[N-A]));
  long long ans=0;
  if(v_arr[N-A] == v_arr[N-1]){
    for(int i = A; i <= std::min(thr_right,B); i++){
      ans += combination(thr_right, i);
    }
  }else{
    ans = combination(thr_right-thr_left, A-thr_left);
  }

  double ave = 0;
  for(int i = 0; i < A; i++){
    ave += (1.0*v_arr[N-1-i])/A;
  }
  std::cout << std::fixed << std::setprecision(6) << ave << "\n" << ans << std::endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <string>
#include<regex>
using namespace std;

int main()
{
    string t;
    cin >> t;
    for(int i=0;i<t.length();i++){
        if(t[i]=='?'){
            t[i]='D';
        }
    }
    cout << t  << endl;
    return 0;
}

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

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

int main(){

 long long m,n;
 cin>>n>>m;

  vector<long long>v;


    int sum =0;
 for(int i=0,x;i<n;i++){
    cin>>x;
    v.push_back(x);
     sum += x; }


    sort(v.begin(),v.end());
    int cnt=0;
   for(int i=0;i<n;i++){
    if( (v[i] * 4*m) >= sum)
        cnt++;
   }

   if(cnt >=m)
    cout<<"Yes"<<endl;
   else cout<<"No"<<endl;

  return 0;
  }


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<iomanip>
#include<string>
#include<math.h>
#define MOD 1000000007

using namespace std; 
int main(){
    int n,k;
    int ans=0;
    char d[10];
    string nn;
    cin>>n>>k;
    for(int i=0;i<k;i++){
        cin>>d[i];
    }
    for(int i=n;i<=10*n;i++){
        nn=to_string(i);
        bool flag=true;
        for(int j=0;j<nn.length();j++){
            for(int l=0;l<k;l++){
                if(d[l]==nn[j])flag=false;
            }
        }
        if(flag){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  int coin;
  cin >> A >> B;
  
  for(int i = 0;i < 2;i++){
  if(A >= B){
    coin += A;
    A--;
  } else if( A < B){
    coin += B;
    B--;
  }
  }
  cout << coin << endl;
    
    
}

Measured memory_bytes: 256
import numpy as np
import math

# class Place():
#     def __init__(self, idx, x, cost):
#         self.idx = idx
#         self.x = x
#         self.cost = cost

# def calc_distance(max_value, min_value):
#     if (max_value < 0):
#         return 2 * abs(max_value) + 2 * abs(max_value - min_value)
#     elif (min_value > 0):
#         return 2 * abs(min_value) + 2 * abs(max_value - min_value)
#     else:
#         return 2 * (abs(min_value) + abs(max_value))


# def calc_cost(X):
#     N = len(X)
#     assert(calc_distance(3, -1) == 8)
#     assert(calc_distance(-1, -3) == 6)
#     assert(calc_distance(5, 3) == 10)
#     for i in range(N):
#         if i == 0:
#             X[i].cost = calc_distance(X[N - 1].x, X[1].x)
#         elif i == N - 1:
#             X[i].cost = calc_distance(X[N - 2].x, X[0].x)
#         else:
#             X[i].cost = calc_distance(X[N - 1].x, X[0].x)
#     return X


def main():
    N = int(input())

    X = [int(c) for c in input().split()]
    X.insert(0, 0)
    X.append(0)
    Y = []
    length = len(X)
    for i in range(length - 1):
        Y.append(X[i + 1] - X[i])
    normal_distance = 0
    for i in range(length - 1):
        normal_distance += abs(Y[i])
    for i in range(N):
        if Y[i + 1] * Y[i] >= 0: 
            print(normal_distance)
        else:
            print(normal_distance - 2 * min(abs(Y[i]), abs(Y[i + 1])))

    # input_lists = [int(c) for c in input().split()]
    # for i in range(N):
    #     x = input_lists[i]
    #     place = Place(i, x, None)
    #     X.append(place)

    # X = sorted(X, key=lambda t: t.x)

    # assert(X[0].x == min(input_lists))

    # X = calc_cost(X)

    # X = sorted(X, key=lambda X: X.idx)

    # for i in range(N):
    #     print(X[i].cost)

if __name__ == '__main__':
    main()

Measured memory_bytes: 31940
def main():
    S = input()
    N = len(S)
    K = int(input())
    top_k = []
    for i in range(N):
        for j in range(i + 1, min([i + K, N]) + 1):
            st = S[i:j]
            top_k.append(st)
            if len(top_k) > K:
                top_k = list(set(top_k))
                top_k.sort()
                top_k = top_k[:K]
    top_k.sort()
    print(top_k[-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int DN=3005,M=1e9+7;
double n,a[DN],dp[DN],sum,p1,p2;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    	cin>>a[i];
    dp[0]=1;
    for(int h=1;h<=n;h++)
    {
    	p1=a[h];
    	p2=1-a[h];
    	for(int i=n;i>=0;i--)
    	{
    		dp[i+1]+=dp[i]*p1;
    		dp[i]*=p2;
    	}
    }
    for(int i=n;i>n/2;i--)
    	sum+=dp[i];
    cout<<fixed<<setprecision(12)<<sum;
}


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

using namespace std;

int NUMBERS[101][2];
int A[4][4];
int R[4][4];
int B[10];

int main()
{
  int N;

  for (int i = 1; i < 4; i++)
  {
    for (int j = 1; j < 4; j++)
    {
      cin >> A[i][j];
      NUMBERS[A[i][j]][0] = i;
      NUMBERS[A[i][j]][1] = j;
    }
  }
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> B[i];
    if (NUMBERS[B[i]][0] != 0 && NUMBERS[B[i]][1] != 0)
    {
      R[NUMBERS[B[i]][0]][NUMBERS[B[i]][1]] = 1;
    }
  }

  if ((R[1][1] == 1 && R[1][2] == 1 && R[1][3] == 1) ||
      (R[2][1] == 1 && R[2][2] == 1 && R[2][3] == 1) ||
      (R[3][1] == 1 && R[3][2] == 1 && R[3][3] == 1) ||
      (R[1][1] == 1 && R[2][1] == 1 && R[3][1] == 1) ||
      (R[1][2] == 1 && R[2][2] == 1 && R[3][2] == 1) ||
      (R[1][3] == 1 && R[2][3] == 1 && R[3][3] == 1) ||
      (R[1][1] == 1 && R[2][2] == 1 && R[3][3] == 1) ||
      (R[1][3] == 1 && R[2][2] == 1 && R[1][3] == 1))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << x << "\n"
using namespace std;
vector<int>ans;
signed main() {
	int m, k; cin >> m >> k;
	if (m == 1) {
		if (k == 0) puts("0 0 1 1");
		else puts("-1");
		return 0;
	}
	int p = 1; for1(i, m)p *= 2;
	if (p <= k) { puts("-1"); return 0; }
	for0(i, p) if (i != k) ans.push_back(i);
	ans.push_back(k);
	for0(i, p) if (p - i - 1 != k) ans.push_back(p - i - 1);
	ans.push_back(k);
	for0(i, ans.size()) {
		if (i)cout << ' ';
		cout << ans[i];
	}
	cout << "\n";
}

Measured memory_bytes: 3952
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> snk(n,0);
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        for(int j=0;j<d;j++){
            int aj;
            cin>>aj;
            snk[aj-1]++;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(0==snk[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

using ll = long long;

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

  int n, k;
  cin >> n >> k;

  vector<int> h(n), dp(n, int(1e9));
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }

  dp[0] = 0;
  for (int i = 0; i + 1 < n; ++i) {
    for (int j = 1; j <= k && i + j < n; ++j) {
      dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

  cout << dp[n - 1] << '\n';

  return 0;
}


Measured memory_bytes: 1024
import sys
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]

AB.sort(key=lambda x: x[0])
ans = 0
for a,b in AB:
  p = b if M >= b else M
  ans += a*p
  M -= p
  if M == 0:
    print(ans)
    sys.exit()

Measured memory_bytes: 18124
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


bool cmp(pair<int,int>p,pair<int,int>q) {
    // return p.first>q.first;//descending by first
    // return p.first<q.first;//ascending by first
    // return p.second>q.second;//descending by second
    return p.second<q.second;//ascending by second
}

// bool cmp(int p,int q) {
    // return p>q;//descending
    // return p<q;//ascending
// }


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    int n;
    set<int>s;
    cin>>n;
    int x;
    // int a[n];
    f1(i,n) {
        // cin>>a[n];
        cin>>x;
        s.insert(x);
    }
    
    int k=s.size();

    (k==n)?cout<<"YES"<<endl:cout<<"NO"<<endl;
    
    return 0;
}

Measured memory_bytes: 12956
use proconio::{fastout, input};

use std::cmp::{min, Reverse};
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        t: usize,
    }
    for _ in 0..t {
        input! {
            n: usize,
            mut klr: [(usize, i64, i64); n],
        }
        let mut ans = 0;
        klr.sort_by_key(|&(k, _, _)| k);
        for (_, l, r) in klr.iter() {
            ans += min(l, r);
        }
        let (a, b): (Vec<_>, Vec<_>) = klr.into_iter().partition(|&(_, l, r)| l >= r);
        let mut s = BinaryHeap::new();
        let mut idx = 0;
        for i in 1..=n {
            while idx < a.len() && a[idx].0 == i {
                let (_, l, r) = a[idx];
                s.push(Reverse(l - r));
                idx += 1;
            }
            while s.len() > i {
                s.pop();
            }
        }
        while let Some(Reverse(lr)) = s.pop() {
            ans += lr;
        }
        let mut idx = b.len();
        for i in 1..=n {
            while idx > 0 && b[idx - 1].0 == n {
                idx -= 1;
            }
            while idx > 0 && b[idx - 1].0 == n - i {
                let (_, l, r) = b[idx - 1];
                s.push(Reverse(r - l));
                idx -= 1;
            }
            while s.len() > i {
                s.pop();
            }
        }
        while let Some(Reverse(rl)) = s.pop() {
            ans += rl;
        }
        println!("{}", ans);
    }
}


Measured memory_bytes: 19504
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

#include <iomanip>

class D {
	int n;
	int maxt{ 0 };
	vector<double> h;
	vector<vector<double>> tr;
	int w;
public:
	D()
	{
		cin >> n;
		tr.resize(n, vector<double>(2));

		REP(i, n)
		{
			int x;
			cin >> x;
			maxt += x;
			tr[i][0] = x;
		}

		REP(i, n)
			cin >> tr[i][1];

		w = 2 * maxt + 1;
		h.resize(w, (double)maxt / 2);
	}

	void left(int et, double ev)
	{
		//cout << "Calling left at time = " << et << " val = " << ev << endl;

		for (int t{ 2 * et }; t >= 0; t--)
		{
			double v{ ev + ((double)et * 2 - t) / 2 };
			//if (ev == 2)
			//	cout << "Making time =" << (double)t / 2 << " to height = " << v << endl;
			chmin(h[t], v);
		}
	}

	void right(int st, double sv)
	{
		for (int t{ 2 * st }; t <= maxt * 2; t++)
		{
			double v{ sv + ((double)t - (double)2 * st) / 2 };
			
			chmin(h[t], v);
		}
	}

	void horiozn(int st, int et, double v)
	{
		for (int t{ st * 2 }; t <= et * 2; t++)
			chmin(h[t], v);
	}

	void solve()
	{

		right(0, 0);
		left(maxt, 0);

		int t{ 0 };
		REP(i, n)
		{

			left(t, tr[i][1]);
			horiozn(t, t + tr[i][0], tr[i][1]);
			t += tr[i][0];
			right(t, tr[i][1]);
		}

		double ans{ 0 };

		REP(i, 2 * maxt)
		{
			ans += (h[i] + h[i + 1]);
		}

		ans /= 4;

		cout <<setprecision(12) << ans << endl;

		//REP(i, w)
		//	cout << h[i] << " ";
		//cout << endl;
	}

};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long 
#define inf 0x7fffffff
#define clr(c) memset(c,0,sizeof(c))
using namespace std;
int mod=998244353;
const int M=1e6+10;
const int N=5e5+10;
inline ll read(){
    ll b=1,sum=0; char c=getchar();
    while(!isdigit(c)){if(c=='-') b=-1; c=getchar();}
    while(isdigit(c)){sum=sum*10+c-'0'; c=getchar();}
    return b*sum;
}
int n,m,k,T;
int len,ans;
int main() 
{
    int i,j;
    int a=read(),b=read(),c=read();
    swap(a,b);
    swap(a,c);
    printf("%d %d %d",a,b,c);

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#define EPS 1e-10
using namespace std;

double add(double a,double b){
	if(fabs(a+b)<EPS*(fabs(a)+fabs(b)))return 0.0;
	return a+b;
}

struct point{
	double x,y;
	point(){}
	point(double xx,double yy){
		x=xx;
		y=yy;
	}
	point operator +(point p){
		return point(x+p.x,y+p.y);
	}
	point operator -(point p){
		return point(x-p.x,y-p.y);
	}
	point operator *(double d){
		return point(x*d,y*d);
	}
	double dot(point p){
		return add(p.x*x,p.y*y);
	}
	double det(point p){
		return add(x*p.y,-y*p.x);
	}
	double len(){
		return sqrt(add(x*x,y*y));
	}
};

bool on_seg(point p1,point p2,point q){
	return (p2-p1).det(p2-q)==0 && (p1-q).dot(p2-q)<=0;
}

point intersection(point p1,point p2,point q1,point q2){
	return p1+(p2-p1)*((q2-q1).det(q1-p1)/(q2-q1).det(p2-p1));
}

double x[4][4];
double y[4][4];
point p[8];
point g[3];
double len[3];
string check(){
	if((p[0]-p[2]).dot(p[1]-p[3])==0)return "kyo";
	g[0]=intersection(p[0],p[1],p[2],p[3]);
	if(!(on_seg(p[0],p[1],g[0]) && on_seg(p[2],p[3],g[0])))return "kyo";
	
	if((p[0]-p[4]).dot(p[1]-p[5])==0)return "kyo";
	g[1]=intersection(p[0],p[1],p[4],p[5]);
	if(!(on_seg(p[0],p[1],g[1]) && on_seg(p[4],p[5],g[1])))return "kyo";
	
	if((p[2]-p[4]).dot(p[3]-p[5])==0)return "kyo";
	g[2]=intersection(p[2],p[3],p[4],p[5]);
	if(!(on_seg(p[2],p[3],g[2]) && on_seg(p[4],p[5],g[2])))return "kyo";
	
	len[0]=(g[0]-g[1]).len();
	len[1]=(g[1]-g[2]).len();
	len[2]=(g[0]-g[2]).len();
	double s=(len[0]+len[1]+len[2])/2.0;
	double S=sqrt(s*(s-len[0])*(s-len[1])*(s-len[2]));
	if(S<EPS)return "kyo";
	if(S<100000.0)return "syo-kichi";
	if(S<1000000.0)return "kichi";
	if(S<1900000.0)return "chu-kichi";
	return "dai-kichi";
}

int main(void){
	while(1){
		scanf("%lf %lf %lf %lf",&x[0][0],&y[0][0],&x[1][0],&y[1][0]);
		if(x[0][0]==0.0 && y[0][0]==0.0 && x[1][0]==0.0 && y[1][0]==0.0)break;
		p[0]=point(x[0][0],y[0][0]);
		p[1]=point(x[1][0],y[1][0]);
		for(int i=1;i<=2;i++){
			scanf("%lf %lf %lf %lf",&x[0][i],&y[0][i],&x[1][i],&y[1][i]);
			p[i*2+0]=point(x[0][i],y[0][i]);
			p[i*2+1]=point(x[1][i],y[1][i]);
		}
		cout << check() << endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  if (S == "RRR") puts("3");
  else if (S == "SSS") puts("0");
  else if (S == "RRS" || S == "SRR") puts("2");
  else puts("1");
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n - 1); 0 <= i; --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

namespace My
{
template <typename ArrayT>
static void DumpArray(const ArrayT &arr)
{
#if defined(HOME)
	for (auto it = std::begin(arr); it != std::end(arr); ++it) {
		cerr << *it << " ";
	}
	cerr << endl;
#endif
}
template<typename T>
static void DumpGrid(const vector<vector<T>> &grid){
#if defined(HOME)
	REP (i, grid.size()) {
		REP (j, grid[i].size()) {
			cerr << grid[i][j] << " ";
		}
		cerr << endl;
	}
#endif
}
template <class ArrayT, typename T>
static void InitArray(ArrayT &arr, T initValue){
	for (auto &v : arr){
		v = initValue;
	}
}
template <typename T>
static bool ReplaceIfSmaller(T &target, T value)
{
	if (value < target) {
		target = value;
		return true;
	} else {
		return false;
	}
}
template <typename T>
static bool ReplaceIfBigger(T &target, T value)
{
	if (target < value) {
		target = value;
		return true;
	} else {
		return false;
	}
}

class Solver
{
  public:
	Solver() {}
	void Solve(istream &cin, ostream &cout)
	{
		int N;
		cin >> N;

		int pa[N+1];
		pa[N] = N;	// 何でもいい。配列外参照を避けるために1つ余分に確保
		int p;
		REP (i, N) {
			cin >> p;
			pa[i] = p - 1;
		}

		int ans = 0;
		REP (i, N) {
			if (pa[i] == i){
				// 次の要素と入れ替える
				std::swap(pa[i], pa[i + 1]);
				++ans;
			}
		}

		cout << ans << endl;
	}
};
} // namespace My

#if !defined(BOOST_TEST_MODULE)
#if !defined(GTEST_INCLUDE_GTEST_GTEST_H_)
int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);

	My::Solver solver;
	solver.Solve(std::cin, std::cout);

	return 0;
}
#endif
#endif


Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

int main(){
  char x; cin >>x;
  if(x+0<91) cout <<'A';
  else cout <<'a';
return 0;}

Measured memory_bytes: 3632
using System;
using System.Linq;
 
class program
{
    static void Main()
    {
        var s = Console.ReadLine();
        var ans = 0;
        if ('R' == s[0]) ans += 1;
        if ('R' == s[1]) ans += 2;
        if ('R' == s[2]) ans += 4;
      
        if (ans == 3 || ans == 6) ans = 2;
        else if (ans == 7) ans = 3;
        else if (ans != 0) ans = 1;
        else ans = 0;
        Console.Write(ans);
                
    }
}

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

int main()
{
    map<int, bool>memo;

    int N;
    cin>>N;

    int cnt=0;

    for(int i=0; i<N; i++){
        int p[3];
        cin >> p[0]>>p[1]>>p[2];

        sort(p,p+3);
        int k=((p[0]-1)*1000+(p[1]-1))*1000+(p[2]-1);

        if(memo.find(k)!=memo.end()){
            cnt++;
        }else{
            memo[k]=true;
        }
        
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 3180
def merge(A,left,mid,right):
    global ct
    n1=mid-left
    n2=right-mid
    l=[A[left+i] for i in xrange(n1)]
    r=[A[mid+i] for i in xrange(n2)]
    l.append(float('inf'))
    r.append(float('inf'))
    i=0
    j=0
    for k in xrange(left,right):
        if l[i]<=r[j]:
            A[k]=l[i]
            i=i+1
        else:
            A[k]=r[j]
            j=j+1
            ct+=n1-i

def mergesort(A,left,right):
    if left+1<right:
        mid=(left+right)/2
        mergesort(A,left,mid)
        mergesort(A,mid,right)
        merge(A,left,mid,right)

ct=0
n=input()
A=map(int,raw_input().split())
mergesort(A,0,n)
print(ct)

Measured memory_bytes: 23616
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+10;
int n,a[N],ans[N],tot,dp[N],first[N];
struct edge{
	int to,next;
}e[N*2];
void add(int u,int v){
	e[++tot].next=first[u],first[u]=tot;
	e[tot].to=v;
}
void dfs(int x,int f){
	int len=lower_bound(dp+1,dp+n+1,a[x])-dp;
	int tmp=dp[len];
	dp[len]=a[x];
	ans[x]=max(len,ans[f]);
	for(int i=first[x];i;i=e[i].next){
		int u=e[i].to;
		if(u!=f)dfs(u,x);
	}
	dp[len]=tmp;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1,u,v;i<n;i++){
		scanf("%d%d",&u,&v);
		add(u,v);add(v,u);
	}
	memset(dp,0x3f3f3f3f,sizeof(dp));
	dfs(1,0);
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 24368
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ld r;
    cin>>r;
    cout<<r*2.0000*3.1415926535<<endl;
}


Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 100000000;

int cost[101][101];
int d[101];
bool used[101];
int n,k;

int dijkstra(int s, int g) {
  fill(d,d+n,INF);
  fill(used,used+n,false);
  d[s] = 0;

  while(true) {
    int v = -1;
    
    for (int u = 0; u < n; u++ ) {
      if (!used[u] && ( v == -1 || d[u] < d[v])) v = u;
    }

    if (v == -1) break;
    used[v] = true;

    for (int u = 0; u < n; u++ ) {
      d[u] = min(d[u],d[v] + cost[v][u]);
    }
  }
  if ( d[g] == INF ) return INF;
  else return d[g];

}

int main() {
  while (cin >> n >> k, n||k) {
    for ( int i = 0; i < n; i++ ) {
      for ( int j = 0; j < n; j++ ) {
	cost[i][j] = INF;
      }
    }
    for ( int i = 0; i < k; i++ ) {
      int order; cin >> order;
      if ( order == 0 ) {
	int a,b; cin >> a >> b;
	a--; b--;
	int ans = dijkstra(a,b);
	if ( ans == INF ) cout << -1 << endl;
	else cout << ans << endl;
      } else if ( order == 1 ) {
	int c,d,e; cin >> c >> d >> e;
	c--; d--;
	cost[c][d] = min(e,cost[c][d]);
	cost[d][c] = min(e,cost[d][c]);
      }
    
    }
  }
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n,sum = 0;
  Vi a(n);
  cin >> n;
  rep(i,0,n) {
    cin >> a[i];
    sum += a[i];
  }
  
  int m,qw,er;
  cin >> m;
  rep(i,0,m){
    cin >> qw >> er;
    cout << sum - a[qw-1] + er << endl;
  }
}


Measured memory_bytes: 49408
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  map<ll, ll> mp;
  for (int i = 0; i < N; i++) {
    ll tmp;
    cin >> tmp;
    mp[tmp]++;
  }

  ll ans = 0;
  for (auto &e : mp) {
    if (e.first < e.second) {
      ans += (e.second - e.first);
    } else if (e.first > e.second) {
      ans += e.second;
    }
  }

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

Measured memory_bytes: 6272
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;bool ans = false;cin >> s;
  for(int i = 0;i<s.size()-1;i++){
    if (s.substr(i,2) == "AC") ans = true;
  }
  cout << ((ans) ? "Yes":"No") << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

var N int
var ANS int

func main() {
	fmt.Scan(&N)
	rec(0)
	fmt.Println(ANS)
}

func rec(n int) {
	if n <= N {
		verify := make(map[int]bool)
		tmpn := n
		for tmpn > 0 {
			x := tmpn % 10
			verify[x] = true
			tmpn /= 10
		}
		if len(verify) == 3 {
			ANS++
		}
		rec(n*10 + 3)
		rec(n*10 + 5)
		rec(n*10 + 7)
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#include<unordered_map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;


int main() {

	int N;
	cin >> N;
	map<string, int> f;
	rep(i, N) {
		
		string a;
		cin >> a;
		f[a] = 1;
	}
	int ans=0;
	for (auto i = f.begin(); i != f.end(); ++i) {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19196
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// input
void input() {}
template <class Head, class... Tail>
void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

// outs
void outs() {}
template <class Head, class... Tail>
void outs(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  outs(forward<Tail>(tail)...);
}

template <class T>
void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void outs(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// outl
void outl() {}
template <class Head, class... Tail>
void outl(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  outl(forward<Tail>(tail)...);
}

template <class T>
void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// outn
void outn() {}
template <class Head, class... Tail>
void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

// dump
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

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

  var(int, N);

  i64 res = 0;
  reps(i, 1, N) {
    string subs = to_string(i);
    if (subs.length() % 2) ++res;
  }

  outl(res);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll a,b,c;
  cin >> a >> b >> c;
  a-=b;
  cout << max(0ll,c-a) << endl;
}

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

Measured memory_bytes: 3656
#include <cstdio>
#include <algorithm>
using namespace std;

int w, h;
int map[20][20];
int ans = 11;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};

int dfs(int x, int y, int move){
//	printf("x:%d y:%d move:%d\n", x, y, move);
	if(move == 11) return 0;
	for(int i=0; i<4; i++){
//		printf(" direction:%d\n", i);
		int nx = x, ny = y;
		if(0<=x+dx[i] && x+dx[i]<w && 0<=y+dy[i] && y+dy[i]<h && map[x+dx[i]][y+dy[i]] != 1){
//			printf(" Start moving\n");
			while(1){
//				printf("  %d %d\n", nx, ny);
				if(nx+dx[i]<0 || w<=nx+dx[i] || ny+dy[i]<0 || h<=ny+dy[i]) break;
//				printf("  On board\n");
				if(map[nx+dx[i]][ny+dy[i]] == 3){
					ans = min(ans, move+1);
//					printf("Goal! move=%d\n", move+1);
					break;
				}
//				printf("  Not Goal\n");
				if(nx+dx[i]<0 || w<=nx+dx[i] || ny+dy[i]<0 || h<ny+dy[i]){
//					printf("  Fall from board\n");
					break;
				}
				if(map[nx+dx[i]][ny+dy[i]] == 1){
//					printf("  Stop moving\n");
					map[nx+dx[i]][ny+dy[i]] = 0;
					dfs(nx, ny, move+1);
					map[nx+dx[i]][ny+dy[i]] = 1;
					break;
				}
//				printf("  Continue moving\n");
				nx += dx[i];
				ny += dy[i];
//				printf("  next:%d, %d\n", nx, ny);
			}
		}
	}
	return 0;
}

int main(){
	while(1){
		scanf("%d %d", &w, &h);
		if(w == 0 && h == 0) break;

		ans = 11;
		for(int i=0; i<20; i++){
			for(int j=0; j<20; j++){
				map[i][j] = 0;
			}
		}


		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				scanf("%d", &map[j][i]);
			}
		}

		int sx, sy;
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				if(map[j][i] == 2){
					sx = j;
					sy = i;
					map[j][i] = 0;
				}
			}
		}
		dfs(sx, sy, 0);

		if(ans == 11) printf("-1\n");
		else printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 1040
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> A(n);
	for(int i = 0;i<k;i++)
	{
		int d;
		cin >> d;
		for(int j = 0;j<d;j++)
		{
			int a;
			cin >> a;
			a--;
			A[a]++;
		}
	}
	int ans = 0;
	for(auto i:A)if(i==0)ans++;
	cout<<ans<<endl;
}

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

struct Node {
    int a, b;
} x[200005];

bool cmp(Node a, Node b) {
    return a.b == b.b ? a.a < b.a : a.b < b.b;
}

int n;

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%d%d", &x[i].a, &x[i].b);
    sort(x + 1, x + n + 1, cmp);
    long long tmp = 0;
    bool check = 1;
    for (int i = 1; i <= n; ++i) {
        tmp += x[i].a;
        if (tmp > x[i].b) check = 0;
    }
    puts(check ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int a;
    int b;
    int c;

    scanf("%d %d %d", &a, &b, &c);

    if (a < b && b < c)
    {
        puts("Yes");
    }
    else
    {
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 1816
s=input()
ans="AC"
if s[0]!="A":
    ans="WA"
c=0
idx=0
for i in range(2,len(s)-1):
    if s[i]=="C":
        c+=1
        idx=i
if c!=1:
    ans="WA"
small={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
for i in range(1,len(s)):
    if i!=idx:
        if s[i] not in small:
            ans="WA"
            break
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;  cin >> n;
  string s[n];
  vector<vector<int> > v(n);
  for(int i=0 ; i<n ; i++){
    cin >> s[i];
  }
  string ans = "";
  for(char c='a';c<='z'; c++){
    int small = 100;
    for(int i=0 ; i<n ; i++){
      int cnt = 0;
      for(int j=0 ; j<s[i].size() ; j++){
        if(s[i][j]==c){
          cnt++;
        }
      }
      small = min(small,cnt);
    }
    for(int i=0 ; i<small ; i++){
      ans += c;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define FILL0(x) memset(x,0,sizeof(x))
#define FILL1(x) memset(x,-1,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

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; }



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int n, k;

    cin >> n;
    cin >> k;

    int a[n];
    rep(i, n)
    {
        cin >> a[i];
    }

    int l = 0;
    int r = 1e9;

    while(r-l>1)
    {
        int mid = (r+l)/2;

        auto judge = [&](int val)
        {
            ll count = 0;
            rep(i, n)
            {
                count += (a[i]-1)/val;
            }
            return count <= k;

        };

        if(judge(mid))
        {
            r=mid;
        }
        else
        {
            l=mid;
        }
    }
    
    cout << r << endl;





    return 0;

}


Measured memory_bytes: 4400
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>

using namespace std;

#define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define ull unsigned long long

int tower[42];
int n;
double r;
int main(void){
	while (true){
		cin >> r >> n;
		if (r == 0)return(0);
		memset(tower, 0, sizeof(tower));
		rep(i, 0, n){
			int l, r,h;
			cin >> l >> r >> h;
			rep(j, l, r)if (tower[(j+42)%42] < h)tower[(j+42)%42] = h;
		}

		int min_h = 20;
		rep(i, 0, 21){
			if (tower[i]>tower[41 - i])tower[i] = tower[41 - i];
			//cout << i << " " << tower[i] << endl;
			if (min_h < tower[i])tower[i] = min_h;
			else min_h = tower[i];
		}
		double ans = 20,x;
		rep(i, 0, 21){
			x = (double)(20 - i);
			if (x>=r)continue;
			x = sqrt(r*r - x*x);
			ans = min(tower[20-i]+(r-x), ans);
			//cout << ans << endl;
		}
		printf("%5f\n", ans);
	}


}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  for( int i = 0; i < N; i++ ) cin >> a.at(i);
  
  int count = 0;
  for( int i = 0; i < N; i++ ){
    while( true ){
      if( a.at(i) % 2 == 0 ){
        a.at(i) /= 2;
        count++;
      }else{
        break;
      }
    }
  }
  cout << count << endl;
  
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int[] array;
    static int n;
    static int g;
    static int[] p;
    static int[] c;
    static int INF = 1001001009;
    static int ans = INF;
    
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        g = sc.nextInt() / 100;
        
        // array: 長さnのbit列
        array = new int[n];
        
        // 全探索する時のデータを取得
        p = new int[n];
        c = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            c[i] = sc.nextInt() / 100;
        }
        
        // arrayのパターンを全探索
        // ex.[1, 1, 1], [1, 1, 2], ... , [m, m, m]
        dfs(0, 0);
        
        // ans: costの最小値
        if (ans == INF) ans = -1;
        System.out.println(ans);
    }
    
    public static void dfs(int index, int now) {
        // 終了条件
        if (index == n) {
            // できあがったarrayで計算
            int score = 0;
            int cost = 0;
            
            for (int i = 0; i < n; i++) {
                if (array[i] == 1) {
                    score += (i+1) * p[i] + c[i];
                    cost += p[i];
                }
            }
            
            
            if (score < g) {
                for (int i = n-1; i >= 0; i--) {
                    if (array[i] == 0) {
                        int goal = g - score;
                        int max = (i+1) * (p[i]-1);
            
                        
                        if (goal <= max) {
                            int need = (goal+i) / (i+1);
                            score = g;
                            cost += need;
                        }
                        
                        break;
                    }
                }
            }
            
            if (score >= g) {
                ans = Math.min(ans, cost);
            }
            return;
        }
        
        // 次項の取る値: 0 or 1
        for (int i = 0; i < 2; i++) {
            array[index] = i;
            dfs(index + 1, i);
        }
    }
}

Measured memory_bytes: 35716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

ll N, M;
vector<ll> v;

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


int main() {
    cin >> N >> M;
    for (ll i = 0; i < N; ++i) {
        ll a; cin >> a; v.push_back(a>>1);
        if (a&1LL) { cout << "0" << endl; return 0; }
    }
  	
  int cMax = 0, cMin = 100;
	for(long long int num : v){
      	num <<= 1;
		int cnt = 0;
		while(num % 2 == 0){
			num /= 2;
			cnt += 1;
		}
		cMax = max(cnt, cMax);
		cMin = min(cnt, cMin);
	}
	if(cMax != cMin){
		cout << 0 << endl;
		return 0;
	}
  
  
    ll lcm = v[0];
    for (int i = 1; i < N; ++i) {
        lcm = (lcm * v[i]) / gcd(lcm, v[i]);
        if (lcm > M) { cout << "0" << endl; return 0; }
    }

    ll ans = 0;
    for (ll i = lcm; i <= M; i += (lcm<<1)) ++ans;

    cout << (M/lcm+1)/2 << endl;

    return 0;
}


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

m=[]
M=[]
for i in range(N):
    a,b=map(int,input().split())
    m.append(a)
    M.append(b)
m.sort()
M.sort()

if N%2==1:
    print(M[N//2]-m[N//2]+1)
else:
    M1=(M[N//2-1]+M[N//2])/2
    m1=(m[N//2-1]+m[N//2])/2
    print(int((M1-m1)*2+1))

Measured memory_bytes: 25544
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  int i;
  int ans=0;
  string a;
  cin>>a;
  vector<bool> s(a.size());
  for(i=0;i<a.size();++i){
    s.at(i)=(a.at(i)=='1');
  }
  for(i=0;i<a.size()-1;++i)
    if(s.at(i)==s.at(i+1)){
      ++ans;
      s.at(i+1)=(!s.at(i+1));
    }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rep(i,a,n) for(int i=(a);i<=(n);++i)
#define dep(i,a,n) for(int i=(a);i>=(n);--i)
#define eps 1e-8
#define pi 3.1415926535897
#define sqr(x) ((x)*(x))
#define MAX(a,b) a=max(a,b)
#define MIN(a,b) a=min(a,b)
#define SZ(x) ((int)(x).size())
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define POSIN(x,y) (1<=(x)&&(x)<=n&&1<=(y)&&(y)<=m)
#define all(x) (x).begin(),(x).end()
#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl
#define buli(x) (__builtin_popcountll(x))
#define bur0(x) (__builtin_ctzll(x))
#define bul2(x) (63-__builtin_clzll(x))
#define pw(x) ((ll(1))<<(x))
#define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a))
#define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a))
#define y0 y0z
#define y1 y1z
#define yn ynz
#define j0 j0z
#define j1 j1z
#define jn jnz
#define tm tmz
#ifdef LOCAL
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...) 
#endif
typedef long long ll;
typedef double lf;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<lf,lf> pff;
typedef complex<double> CD;
const int inf=0x3f3f3f3f;
const int mo=1000000007;
inline void gn(long long&x){
	int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
	while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
template<class T1,class T2>inline void gn(T1&r,T2&s){gn(r),gn(s);}
template<class T1,class T2,class T3>inline void gn(T1&r,T2&s,T3&t){gn(r),gn(s),gn(t);}
template<class T1,class T2,class T3,class T4>inline void gn(T1&r,T2&s,T3&t,T4&u){gn(r),gn(s),gn(t),gn(u);}
inline void gs(char *s){scanf("%s",s);}
inline void gc(char &c){while((c=getchar())>126 || c<33);}
inline void pc(char c){putchar(c);}
const int DX[]={1,0,-1,0},DY[]={0,1,0,-1};
ll powmod(ll a,ll b) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll powmod(ll a,ll b,ll mo) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//*******************************************

const int N=211111,M=111111;
int l,m,n,t,C;
char s[N];
int a[N];
int main(){
#ifdef LOCAL
	freopen("B.in","r",stdin);//freopen("B.out","w",stdout);
#endif
	scanf("%s",s+1);n=strlen(s+1);
	rep(i,1,n)a[s[i]-'a']++;
	ll ans=1ll*n*(n-1)/2;
	rep(i,0,25)ans-=1ll*a[i]*(a[i]-1)/2;
	ans++;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 512