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

typedef long long ll;
typedef long double ld;



int main(){
    ll a,b;
    ll c,d;

    cin >> a >> b >> c >> d ;

    while(a > 0 || c > 0){
        if(c <= b){
            cout << "Yes" << endl; break;
        }else{c = c-b;}

        if(a <= d){
            cout << "No" << endl; break;
        }else{a = a-d;}
    }
    return 0;
}

Measured memory_bytes: 3624
main = do
  [s, t] <- words <$> getLine
  [a, b] <- map read . words <$> getLine
  u <- getLine
  putStrLn $ unwords $ map show $ f s a b u
  
f s a b u =
  if s == u
  then [a - 1, b]
  else [a, b - 1]


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int h,w; cin >> h >> w;
  int a[h][w];
  REP(i,h) REP(j,w) cin >> a[i][j];

  vector<tuple<int,int,int,int>> ans;
  REP(i,h-1) {
    REP(j,w) {
      if(a[i][j]%2==0) continue;
      a[i][j]--; a[i+1][j]++;
      ans.push_back( make_tuple(i,j,i+1,j) );
    }
  }
  REP(j,w-1) {
    if (a[h-1][j]%2==0) continue;
    a[h-1][j]--; a[h-1][j+1]++;
    ans.push_back( make_tuple(h-1,j,h-1,j+1) );
  }

  cout << ans.size() << endl;
  for(auto x: ans) {
    int x1,y1,x2,y2;
    tie(x1,y1,x2,y2) = x;
    x1++,y1++,x2++,y2++;
    printf("%d %d %d %d\n",x1,y1,x2,y2);
  }
  return 0;
}

Measured memory_bytes: 6252
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	string str, res;
	getline(cin, str);

	rep(i, str.size())
	{
		if(i + 4 < str.size() && str.substr(i, 5) == "apple")
		{
			res += "peach";
			i += 4;
		}
		else if(i + 4 < str.size() && str.substr(i, 5) == "peach")
		{
			res += "apple";
			i += 4;
		}
		else
		{
			res += str[i];
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		Arrays.sort(arr);
		HashSet<Long> set = new HashSet<>();
		long another = 0;
		for (int i = n - 1; i >= 0; i--) {
		    long a = arr[i];
		    if (set.contains(a)) {
		        if (another == 0) {
		            another = a;
		            set.remove(a);
		        } else {
		            System.out.println(another * a);
		            return;
		        }
		    } else {
		        set.add(a);
		    }
		}
        System.out.println(0);
	}
}


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

int main(){
  int N;
  cin >> N;
  vector<string> S(N+1);
  S.at(0)="";
  for(int i=1; i<=N; i++){
    cin >> S.at(i);
  }
  int M;
  cin >> M;
  vector<string> T(M);
  for(int i=0; i<M; i++){
    cin>> T.at(i);
  }
  sort(S.begin(), S.end());
  int Ans=0;
  int subAns=0;
  for(int i=1; i<=N; i++){
      subAns=0;
      for(int j=1; j<=N; j++){
        if(S.at(i)==S.at(j)){
          subAns++;
        }
      }
      for(int k=0; k<M; k++){
        if(S.at(i)==T.at(k)){
          subAns--;
        }
      }
      Ans=max(Ans, subAns);
    }
  cout << Ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int n, m, f, r;
  char grade[50] = {};

  for( n = 0 ; n < 50 ; n++ )
  {
    scanf("%d %d %d", &m, &f, &r);

    if( m == -1 && f == -1 && r == -1 )
      break;
    if( m == -1 || f == -1 )
      grade[n] = 'F';
    else if( m + f >= 80 )
      grade[n] = 'A';
    else if( m + f >= 65 )
      grade[n] = 'B';
    else if( m + f >= 50 )
      grade[n] = 'C';
    else if( m + f >= 30 )
    {
      if( r >= 50 )
        grade[n] = 'C';
      else
        grade[n] = 'D';
    }
    else
      grade[n] = 'F';
  }

  for( m = 0 ; m < n ; m++ )
    printf("%c\n", grade[m]);
}



Measured memory_bytes: 2124
#include <iostream>
#include <string>

using namespace std;

string board[55];

int main() {
	int h, w;
	cin >> h;
	cin >> w;
	for(int i = 0; i < h; i++) {
		cin >> board[i];
	}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if(board[i][j] == '#') {
				continue;
			}
			int count = 0;
			if(i + 1 < h && board[i + 1][j] == '#') {
				count++;
			}
			if(j + 1 < w && board[i][j + 1] == '#') {
				count++;
			}
			if(i - 1 >= 0 && board[i - 1][j] == '#') {
				count++;
			}
			if(j - 1 >= 0 && board[i][j - 1] == '#') {
				count++;
			}
			if(i + 1 < h && j + 1 < w && board[i + 1][j + 1] == '#') {
				count++;
			}
			if(i - 1 >= 0 && j - 1 >= 0 && board[i - 1][j - 1] == '#') {
				count++;
			}
			if(i + 1 < h && j - 1 >= 0 && board[i + 1][j - 1] == '#') {
				count++;
			}
			if(i - 1 >= 0 && j + 1 < w && board[i - 1][j + 1] == '#') {
				count++;
			}
			board[i][j] = ('0' + count);
		}
	}
	for(int i = 0; i < h; i++) {
		cout << board[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n, m;
  cin >> n >> m;
  int x[n], y[n], c[m], d[m];
  for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
  for(int i = 0; i < m; i++) cin >> c[i] >> d[i];
  for(int i = 0; i < n; i++){
    int res = 1, min = 1e9;
    for(int j = 0; j < m; j++){
      int tmp = abs(x[i] - c[j]) + abs(y[i] - d[j]);
      if(tmp < min){
        min = tmp;
        res = j + 1;
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)-1
c = 0
for i in range(2**n):
    S = s[0]
    for j in range(n):
        if (i >> j) & 1 == 1:
            S += "+" + s[j+1]
        else:
            S += s[j+1]
    c += eval(S)
print(c)    

Measured memory_bytes: 9056
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
    int n;
    scanf("%d", &n);
    vector<int> h(n);
    for(int& x : h) {
        scanf("%d", &x);
    }
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    int i;
    for(i=2; i<n;i++)
    {
        dp[i] = min(dp[i-1]+ abs(h[i]-h[i-1]),dp[i-2]+ abs(h[i]-h[i-2]));
    }
    cout<<dp[i-1]<<endl;

}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>

#define MAX 100001

using namespace std;


class UF_tree{

    vector<int> par;
    vector<int> rank;
    vector<int> sz;

public:
    UF_tree(){}
    UF_tree(int n){
        par = rank = sz = vector<int>(n);
        for(int i=0; i<n; i++){
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }

    int find(int x){
        if(par[x] == x) return x;
        else return find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y)  return;

        if(rank[x] < rank[y]){
            par[x] = y;
            sz[y] += sz[x];
        }
        else{
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
            sz[x] += sz[y];
        }
    }

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

    int size(int x){
        return sz[find(x)];
    }

};

int main(){
    long N, M;
    cin >> N >> M;
    int A[M], B[M];
    for(int i=0; i<M; i++) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }
    long ans[M];
    ans[M-1] = N * (N-1) / 2;

    UF_tree uf(N);
    for(int i=M-1; i>=1; i--){
        if (uf.same(A[i], B[i])) ans[i-1] = ans[i];
        else{
            ans[i-1] = ans[i] - uf.size(A[i]) * uf.size(B[i]);
        }
        uf.unite(A[i], B[i]);
    }
    for(int i=0; i<M; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 4096
//CODEFORCES:-
    //coded by AMAN BHARTI NIT PATNA
    //ECE 2K18
    #include<bits/stdc++.h>
    using namespace std;

    //#define home
    #define TASK "soln"
    #define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
    #define pb push_back
    #define pp pop_back
    #define ll long long int
    #define ull unsigned long long
    #define br cout<<endl;
    #define fo for(int i=0;i<n;i++)
    #define foo for(int i=1;i<=n;i++)
    #define rep(i,a,n) for(int i=a;i<n;i++)
    #define mod 1000000007
    ll gcd(ll a,ll b);
    ll power(ll a,ll b);
    ll powerwithmod(ll a,ll b);
    ll nCr(ll n,ll r);
    ll fact(ll n);


    void solve(){
        int x;
        cin>>x;
        if(x==0)cout<<1;
        else cout<<0;
        br;
    }

    int main(){
         #ifdef home
            assert(freopen(TASK".in","r",stdin));
            assert(freopen(TASK".out","w",stdout));
        #endif

        ios::sync_with_stdio(false);
        cin.tie(NULL);

        // int t;
        // cin>>t;
        // while(t-->0)
        solve();

        #ifdef home
            eprintf("Time: %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
        #endif

        return 0;
    }

    ll gcd(ll a,ll b) {if(b==0)return a;return gcd(b,a%b);}
    ll powerwithmod(ll a,ll b) {ll res=1;while(b>0){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return res%mod;}
    ll power(ll a,ll b) {ll res=1;while(b>0){if(b&1)res=(res*a);a=(a*a);b>>=1;}return res;} 
    ll nCr(ll n, ll r){return fact(n) / (fact(r) * fact(n - r));} 
    ll fact(ll n){ll res = 1;for(ll i = 2; i <= n; i++)res = res * i;return res;}

Measured memory_bytes: 3648
#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 H;
    int A;
    int ans = 0;
    cin >> H >> A;
    while (true)
    {
        ++ans;
        H -= A;
        if (H <= 0)
            break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

const int MAXN = 1005;
int n;
queue<int> orders[MAXN];


bool done() {
    fo1(i, n) if (!orders[i].empty()) return false;
    return true;
}

void solve() {
    sc(n); int m;
    fo1(i, n) {
        fo(j, n-1) {
            sc(m);
            orders[i].push(m);
        }
    }
    int days = 0;
    set<int> tp1;
    fo1(i, n) tp1.insert(i);
    while (!done()) {
        set<int> tp2;
        for(int i: tp1) if (!orders[i].empty()) {
            int j = orders[i].front();
            if (!orders[j].empty() && orders[j].front() == i) {
                tp2.insert(i);
                tp2.insert(j);
            }
        } 
        if (tp2.empty()) {
            pd(-1);
            return;
        }
        for (int x: tp2) orders[x].pop();
        tp1 = tp2;
        days++;
    }
    pd(days);
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;



int main(){
  int n,m;cin>>n>>m;
  int ans=0;
  vi x(m);
  rep(i,m){
    cin>>x.at(i);
  }

  sort(all(x));

  vi lng(m-1);
  rep(i,m-1){
    lng.at(i)=x.at(i+1)-x.at(i);
  }
  sort(all(lng));

  rep(i,m-1-n+1){
    ans+=lng.at(i);
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 1024
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * (n+1)

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]
    
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.parents[x] > self.parents[y]:
      x,y = y,x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
    
  def size(self, x):
    return -self.parents[self.find(x)]
  
  def same(self, x, y):
    return self.find(x) == self.find(y)
  
  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]
  
  def roots(self):
    return [i for i,x in enumerate(self.parents) if x < 0]
  
  def group_count(self):
    return len(self.roots())
  
N,M = map(int,input().split())
UF = UnionFind(N)
for i in range(M):
  x, y = map(int, input().split())
  UF.union(x,y)

ans = 0
for i in UF.roots():
  ans = max(ans, UF.size(i))
print(ans)



Measured memory_bytes: 18440
END { load __FILE__ unless $stdin.eof? }

n, k = gets.split.map!(&:to_i)
a    = gets.split.map!(&:to_i).sort!
@m = 10**9 + 7

i1 = a.bsearch_index { |x| x >= 0 } || n
i2 = a.bsearch_index { |x| x >  0 } || n

an = a[0...i1]
ap = a[i2..-1].reverse!
nz = i2 - i1

if k > n - nz  # always zero
  puts 0
  exit
end

if ap.empty? && k.odd?  # never positive
  if nz > 0
    puts 0
  else
    puts an.reverse.take(k).inject(1) { |prod, x| prod * x % @m }
  end
  exit
end

init = k.odd? ? ap.shift : 1
k /= 2
an << ap.pop if ap.size.odd?
ap = ap.each_slice(2).map { |x, y| x * (y || 1) }
an = an.each_slice(2).map { |x, y| x * (y || 1) }
a2 = (ap + an).sort!.reverse!
puts a2.take(k).inject(init) { |prod, x2| prod * x2 % @m }


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

def survey(now, mlist, clist):
    for ml in mlist[now]:
        if clist[ml[0]]==2:
            clist[ml[0]]=(clist[now]+ml[1])%2
            _, _=survey(ml[0], mlist, clist)
    return mlist, clist

n=int(input())
mlist=[]
clist=[]
for i in range(n):
    mlist.append([])
    clist.append(2)

for i in range(n-1):
    u, v, m = map(int, input().split())
    u-=1
    v-=1
    mlist[u].append([v, m%2])
    mlist[v].append([u, m%2])

clist[0]=0
now=0
mlist, clist = survey(now, mlist, clist)
for cl in clist:
    print(cl)

Measured memory_bytes: 155364
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    bool f = true;
    int ans = 1e9;
    for(char c = 'a';c <= 'z';c++){
        bool g = true,h = true;
        for(int i = 0;i < s.size();i++){
            if(s[i] == c)g = false;
            if(s[i] != c)h = false;
        }
        if(h){
            ans = 0;
            break;
        }
        if(g)continue;
        int k = 1;
        string t = s;
        while(k++){
            string r = "";
            for(int i = 0;i < t.size()-1;i++){
                if(t[i] == c || t[i+1] == c){
                    r += c;
                }
                else r += t[i];
            }
            t = r;
            bool f = true;
            for(int i = 0;i < t.size();i++){
                if(t[i] != c)f = false;
            }
            if(f){
                ans = min(ans,k-1);
                break;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

string B(int x, int y) {
    for (int i = 0; i <= 100; i++)
        for (int j = 0; j <= 100; j++)
            if (i + j == x && i * 2 + j * 4 == y)
                return "Yes";
    return "No";
}

int main() {
    int x, y;
    cin >> x >> y;
    cout << B(x, y);
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>

using namespace std;

using ll = long long;
using ld = long double;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int A, B; cin >> A >> B;

    if (B == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    int t = A;
    int c = 1;
    while (t < B)
    {
        t += A - 1;
        ++c;
    }

    cout << c << endl;
}


Measured memory_bytes: 256
// abc118_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    int ans = 0;
    REP(i, N){
        int a; cin >> a;
        ans = gcd(ans, a);
    }
    print(ans);


    return 0;
}


Measured memory_bytes: 256
while True:
	p=0
	x,y=map(int,input().split())
	if x==0 and y==0:
		break
	for z in range(1,x):
		for a in range(z+1,x+1):
			for b in range(a+1,x+1):
				if z+a+b==y:
					p+=1
	print(p)


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
int x[200005];
LL sum[200005];
int pick = 0;

int main() {
    scanf("%d%d", &n, &pick);
    forn(i, n) {
        scanf("%d", x + i);
    }

//    n = 200000;
//    pick = 1000000000;
//    forn(i, n) {
//        x[i] = pick - n + i;
//    }

    reverse(x, x + n);
    sum[0] = 0;
    forn(i, n) {
        sum[i + 1] = sum[i] + x[i];
    }
    LL ans = LL(8e18);
    const LL MAX = 4e18;
    for (int times = 1; times <= n; ++times) {
        int group = 1;
        LL cur = 0;
        for (int i = 0; i < n; i += times) {
            ++group;
            LL cost = (LL)group * group - (LL)(group - 1) * (group - 1);
            if (group == 2) {
                cost = 5;
            }
            int cnt = min(n - i, times);
            LL mul = sum[i + cnt] - sum[i];
            if (MAX / cost < mul) {
                cur = ans;
                break;
            }
            cur += cost * mul;
            if (cur > MAX) {
                cur = ans;
                break;
            }
        }
        ans = min(ans, cur + (LL)pick * (times + n));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
# import sys
# import math #sqrt,gcd,pi
# import decimal
import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

# mod = int(1e9+7)
mod = 998244353
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    n,m = readInt()
    g = [[] for i in range(n)]
    for i in range(m):
        x,y = readInt()
        g[x-1].append(y-1)
        g[y-1].append(x-1)
    v = [[-1,-1] for i in range(n)]
    v[0] = [0,0]
    q = queue.Queue()
    q.put(0)
    while not q.empty():
        x = q.get()
        for y in g[x]:
            if v[y][0]!=(-1):
                continue
            q.put(y)
            v[y][0] = v[x][0] + 1
            v[y][1] = x
    print("Yes")
    for i in range(1,n):
        print(v[i][1]+1)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 42400
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define sint(n) scanf("%d",&n)

using namespace std;


int main(){
	while(1){
		int n,k;
		sint(n);
		sint(k);
		
		if(n==0) break;
		
		int kazu[100000];
		rep(i,n) sint(kazu[i]);
		
		int syoki=0;
		
		rep(i,k) syoki+=kazu[i];
		
		int maxi=syoki;
		rep(i,n-k){
			syoki-=kazu[i];
			syoki+=kazu[i+k];
			maxi=max(syoki,maxi);
		}
		
		printf("%d\n",maxi);
	}
}

Measured memory_bytes: 0
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

int main(){
    fastio
    int n ;
    cin >> n ; 
    vector<int> v(n) ; 
    for(int &x : v){
    	cin >> x ; 
    }
    vector<int> tmp = v ; 
    sort(v.rbegin(),v.rend()) ; 
    int first = v[0] ; 
    int second = v[1] ; 
    for(int i=0;i<n;i++){
    	if ( tmp[i] == first ) {
    		cout << second << endl;
    	}
    	else cout << first << endl ; 
    }
    return 0 ;
}


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

int count(int n, int x){
	int cnt = 0;
	int i,j,k;
	for( i=1; i<=n-2; i++ ){
		for( j=i+1; j<=n-1; j++ ){
			for( k=j+1; k<=n; k++ ){
				if( i+j+k == x ) cnt++;
			}
		}
	}
	return cnt;
}

int main(){
	int n,x;

	while(1){
		cin >> n >> x;
		if( n == 0 && x == 0 ) break;
		cout << count(n, x) << endl;
	}

	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 10005
#define int long long
#define T int t;cin>>t;while(t--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define debug(x) cout<<x = <<x<<n;
#define set_dp(dp) memset(dp,-1,sizeof(dp))
using namespace std;

signed main(){
	ios_base::sync_with_stdio(false);	
	cin.tie(0);
	cout.tie(0);
	
 	int n;
 	cin>>n;
 	vector<int> v(n);
 	f(i,0,n) cin>>v[i];
 	float ans = v[0];
 	f(i,1,n){
 		ans = (ans*v[i])/(ans+v[i]);
 	}
 	cout<<ans;
	return 0;
}



Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>
#include <stack>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	int k;
	std::cin >> k;
	std::string s;
	std::cin >> s;
	if(s.size()<=k) print(s);
	else {
		print(s.substr(0,k)+"...");
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 650;
int n;
int a[N][N];

int create() {
    int res = 0;
    for (int k=0; k<n; ++k) {
        bool check = true;
        for (int i=0; i<n; ++i)
            for (int j=0; j<n; ++j)
                if (a[i+k][j] != a[j+k][i]) check = false;
        if (check) res += n;
    }
    return res;
}

int main()
{
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i=0; i<n; ++i) for (int j=0; j<n; ++j) {
        char t; cin >> t;
        a[i][j] = a[i+n][j] = t - 'a' + 1;
    }
    cout << create();
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;

int main(void){
    ll n;
    cin>>n;
    ll d[1000][2];
    for(int i=0;i<n;i++) cin>>d[i][0]>>d[i][1];
    for(int i=0;i<n-2;i++){
        if(d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1]){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;
using Tree = vector<pair<int, int>>;

int main()
{
    int n, k;
    cin >> n >> k;
    int tmp = (n - 1) * (n - 2) / 2;
    if (tmp < k)
        cout << -1;
    else
    {
        cout << n - 1 + tmp - k << "\n";
        for (int i = 2; i < n + 1; i++)
        {
            cout << 1 << " " << i << "\n";
        }
        int hoge = tmp - k;
        for (int i = 2; i < n + 1; i++)
        {
            for (int j = i + 1; j < n + 1; j++)
            {
                if (hoge == 0)
                    return 0;
                cout << i << " " << j << "\n";
                hoge--;
            }
        }
    }
}

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

using ll = long long;
double N;

int main(){
    cin >> N;
    double before = N * 100.0 / 108.0;
    double after = (N+1) * 100.0 / 108.0;

    int be = before;
    if(before - (ll)be == 0){
        // cout << before << " " << (ll)be<< endl;
        cout << be << endl;
    }else{
        if(after > be + 1){
            cout << be + 1 << endl;
        }else{
            cout << ":(" << endl;
        }
    }
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  ll N;
  cin>>N;
  
  vector<pair<ll,ll>>A(N);
  rep(i,N){
    cin>>A[i].first;
    A[i].second=i+1;
  }
  
  sort(all(A));
  rep(i,N){
    cout<<A[i].second<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
	int N,L;
	cin >>N>>L;
	string S[100];
	for(int i=0;i<N;i++){
		cin>>S[i];
	}
	sort(S,S+N);
	for(int i=0;i<N;i++){
		cout<<S[i];
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1e18;

int main() {
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<ll> gr;
    ll a;
    vector<ll>::iterator itl;
    REP(i, n){
        cin >> a;
        itl = lower_bound(gr.begin(), gr.end(), a);
        //cout << ":"  << "," << itl -gr.begin() << endl;
        if( itl - gr.begin() <= 0 ){
            gr.insert(gr.begin(),a);
        }else{
            gr[distance(gr.begin(), itl)-1] = a;
        }
//        sort(gr.begin(), gr.end(), std::greater<ll>());
        //sort(gr.begin(), gr.end());
//        REP(j, gr.size()){
//            cout << gr[j] << " ";
//        }
//        cout << endl;
    }
    cout << gr.size() << endl;
    return 0;
}


Measured memory_bytes: 1400
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int i, j=0, k=0;

	for(i=0; i<4; i++)
	    j+=sc.nextInt();
	for(i=0; i<4; i++)
	    k+=sc.nextInt();

	System.out.println(Math.max(j, k));
    }
}

Measured memory_bytes: 12000
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
char c[1010],s[1010],a[1010];
int main(){
char r=gc();
for (;r!=EOF;){
  if (r==',') pc(' ');
  else pc(r);
  r=gc();
  }
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
const int error=1e9+7;
#define F first
#define S second
#define MK make_pair






int main(){
    int n;
    cin>>n;
    int nd=n;
    int sum=0;
    int k=1000000000;
    for(int i=0;i<=9;i++){
        sum+=n/k;
        n%=k;
        k/=10;
    }
    if(nd%sum==0){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(){

        string str;
        int endPoint,cPoint;
        cin >> str;

        while(true){
                if(str == "-")break;
                cin >> endPoint;
                for(int i = 1; i <= endPoint; i++){
                        cin >> cPoint;
                        str += str.substr(0,cPoint);
                        str.erase(0,cPoint);
                }
                cout << str << endl;
                str.erase(str.begin(),str.end());
                cin >> str;

        }       
        return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
	IOS;
    cout.precision(30);
    ll a,b,c; cin >> a >> b >> c;
    cout << max(c-(a-b),(ll)0);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int N;
  cin>>N;
  string S;
  for (int i=0;i<N;i++){
    cin>>S;
    if (S=="Y"){
      cout<<"Four"<<endl;
      break;
    }
    if (i==N-1){
      cout<<"Three"<<endl;
      break;
    }
  }    
}


Measured memory_bytes: 3620
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


#[allow(unused_imports)]
use std::f64;

fn gcd(a:i64, b:i64) -> i64 {
    if b == 0 { return a; }
    gcd(b, a%b)
}

fn main() {
    input!{n:usize, a:[i64;n]};

    let mut ans = a[0];
    for i in 1..n {
        ans = gcd(ans, a[i]);
    }
    println!("{}", ans);

}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>

using namespace std;

vector<int> par;

int root(int x){

    if (par[x] == x){
        return x;
    }else{
        par[x] = root(par[x]);
        return par[x];
    }
}

int unite(int x, int y){
    int xr = root(x);
    int yr = root(y);
    if(xr == yr){
        return 0;
    }
    par[xr] = yr;
    return 0;
}

int same(int x, int y){
    if (root(x) ==  root(y)){
        return 1;
    }else{
        return 0;
    }
}

int main(){
    int N,M,i,j;
    cin >> N >> M;
    vector<int> p;
    for(i = 0; i < N; i++){
        int k;
        cin >> k;
        p.push_back(k); 
    }
    vector<int> x;
    vector<int> y;
    par.push_back(0);
    for(i = 0; i < N; i++){
        par.push_back(i+1);
    }
    for(i = 0; i < M; i++){
        int a,b;
        cin >> a >> b;
        x.push_back(a);
        y.push_back(b);
    }

    for(i = 0; i < M; i++){
        unite(x[i], y[i]);
    }
    int ans = 0;
    for(i = 0; i < N; i++){
        if(same(p[i], p[p[i]-1]) == 1){
            ans += 1;
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 2296
mod = 3600 * 24
wakeup = [0] * (mod + 11000)
n = int(input())
now = 0
for i in range(n):
    a, b = [int(item) for item in input().split()]
    now += a
    now %= mod
    wakeup[now] += 1
    wakeup[now + 10801] -= 1
    now += b

for i in range(1, mod + 11000):
    wakeup[i] += wakeup[i-1]
    if i != i%mod:
        wakeup[i%mod] += wakeup[i]

print(max(wakeup))

Measured memory_bytes: 6876
#include<stdio.h>

int maxof(int a,int b,int c){
	int max = a ;
	if(max<b) max=b;
	if(max<c) max=c;
	return max;
}


int main(void){
	int N;
	int i;
	int a,b,c;
	int m;

	scanf("%d", &N);
	for(i=0;i<N;i++){
		scanf("%d %d %d", &a, &b, &c);
		m = maxof(a,b,c);

		if(a == m)
			do{if(m*m == b*b+c*c) printf("YES\n");
			else printf("NO\n");}while(0);
		else if(b == m)
			do{if(m*m == a*a+c*c) printf("YES\n");
			else printf("NO\n");}while(0);
		else 
			do{if(m*m == a*a+b*b) printf("YES\n");
			else printf("NO\n");}while(0);
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h> 
using namespace std;
int main()
{
 long long  int b,c,i;
 cin>>b>>c;
 long long int a[b],s=0;
 for(i=0;i<b;i++)
 {
 cin>>a[i];	
 }
 sort(a,a+b);
 for(i=0;i<(b-c);i++)
 {
 s=s+a[i];	
 }
 cout<<s<<endl;
 return 0;
 }


Measured memory_bytes: 1792
//グラフ
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int V, E;
    cin >> V >> E;
 
    vector<vector<int>> G(V);
    for (int i = 0; i < E; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back({b});
        G[b].push_back({a});
    }
    vector<int> dist(V, -1);
    queue<int> q;
    dist[0]=0;
    q.push(0);
    while (!q.empty()) {
        int v = q.front(); // キューから先頭頂点を取り出す
        q.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            q.push(nv);
        }
    }

    if(dist[V-1]==2){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 16060
import java.io.*;
 
public class Main{
    public static void main(String[] argv) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while((line = br.readLine()) != null){
            StringBuffer reverse = new StringBuffer().append(line);
            System.out.print(reverse.reverse()+"\n");
        }
    }
}

Measured memory_bytes: 24072
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();

    for(int i = 0 ; i <= n ; ++i){
      for(int j = 0 ; j <= n-i ; ++j){
        int k = n-i-j;
        if(k<0) break;
        if((10000*i + 5000*j + 1000*k) == y){
          System.out.println(i + " " + j + " " + k);
          return;
        }
      }
      
    }

    System.out.println("-1 -1 -1");
    
  }
}

Measured memory_bytes: 39528
S = list(input())
Flag = True
for i in range(0,len(S)):
  if i % 2 == 1:
    a = S[i]
    if Flag == True and a == 'R':
       Flag = False
  else:
    b = S[i]
    if Flag == True and b == 'L':
       Flag = False
if Flag == True:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll n;
char ch[12];
void dep(ll now,ll ma){
	if(now==n){
		for(ll i=0;i<n;i++){
			cout << ch[i];
		}
		cout <<endl;
		return;
	}
	for(ll i=0;i<=ma;i++){
		ch[now]=i+'a';
		if(i==ma){
			dep(now+1,ma+1);
		}
		else{
			dep(now+1,ma);
		}
	}
}
int main() {
	cin>>n;
	dep(0,0);
	// your code goes here
	return 0;
}

Measured memory_bytes: 3612
H, W, K = map(int, input().split())
Matrix = list()
answer = 0

def main(H, W, Matrix, i, K):
    Blacl_Count = 0 
    Bin = format(i, '12b')
    for a, line in enumerate(Matrix):
        for b, raw in enumerate(line):
            if Bin[-(a+1)] == '1' or Bin[-(b+H+1)] == '1':
                continue
            elif raw == '#':
                Blacl_Count += 1
    if Blacl_Count == K:
        return 1
    else:
        return 0

for h in range(H):
    line = input()
    Matrix.append(line)

iteration = 2**(H+W)

for i in range(iteration):
    answer += main(H, W, Matrix,i, K)

print(answer)

Measured memory_bytes: 9136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s1 = in.next();
		String s2 = in.next();
		int mod = 1000000007;
		long ans = 0;
		int i=0;
		boolean tate = true;
		if(s1.charAt(i)==s2.charAt(i)) {
			ans = 3;
			tate = true;
			i = 1;
		}else {
			ans = 6;
			tate = false;
			i = 2;
		}
		for(;i<n;i++) {
			if(tate) {
				if(s1.charAt(i)==s2.charAt(i)) {
					ans = ans*2%mod;
					tate = true;
				}else {
					ans = ans*2%mod;
					tate = false;
					i++;
				}
			}else {
				if(s1.charAt(i)==s2.charAt(i)) {
					ans = ans%mod;
					tate = true;
				}else {
					ans = ans*3%mod;
					tate = false;
					i++;
				}
			}
		}
		System.out.println(ans);
		in.close();
	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 1000000001;

int main(){
  string a, b;
  cin >> a >> b;
  reverse(all(b));
  if(a == b) cout << "YES" <<endl;
  else cout << "NO" <<endl;
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  sort(a.begin(),a.end());
  vll  s(n+1);
  rep(i,n){
    s[i+1]=a[i]+s[i];
  }
  int ans=1;
  for(int i=n-2; i>=0; i--){
    if(s[i+1]*2<a[i+1]) break;
    else ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,a,ak,h;
    cin>>n>>k>>a;
    h=a;
    for(int i=2;i<=n;i++)
    {
        cin>>ak;
        a=__gcd(a,ak);       
        h=max(ak,h);
    }
    if(k%a==0&&k<=h)        
    {
        cout<<"POSSIBLE"<<endl;
    }
    else
    {
        cout<<"IMPOSSIBLE"<<endl;
    }
}

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

ll gcd(ll x,ll y){
    if (y==0) return x;
    return gcd(y,x%y);
}

vector<ll> divisor(ll n){
    vector<ll> res;
    for (ll i=1;i*i<=n;++i) if (n%i==0){
        res.emplace_back(i);
        if (i!=n/i) res.emplace_back(n/i);
    }
    return res;
}

map<ll,ll> prime_factor(ll n){
    map<ll,ll> res;
    for (ll i=2;i*i<=n;i++){
        while(n%i==0){++res[i];n/=i;}
    }
    if (n!=1) res[n]=1;
    return res;
}

ll square(ll n){
    map<ll,ll> m=prime_factor(n);
    ll res=0;
    for (auto p:m) res=gcd(p.second,res);
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> cand=divisor(N);
    ll ans=0;
    set<ll> cnt;
    ll s=square(N),z=1;
    for (auto p:prime_factor(N)) z*=p.first;
    for (ll w:divisor(s)) cnt.emplace((ll)pow(z,w));
    for (ll x:cand){
        ll y=N/x;
        for (ll i=1;i*i<=x-1;++i) if ((x-1)%i==0){
            if (i!=1){
                ll a=i;
                while(a<y) a*=i;
                if (a==y) cnt.emplace(i);
            } else if ((x-1)/i!=1){
                ll a=(x-1)/i;
                while(a<y) a*=(x-1)/i;
                if (a==y) cnt.emplace((x-1)/i);
            }
        }
    }
    for (ll x:divisor(N-1)){
        if (1<x) cnt.emplace(x);
    }
    cout << cnt.size() << '\n';
}

Measured memory_bytes: 384