akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int A,B,C,X,count;
		count = 0;
		Scanner input = new Scanner(System.in);
		A = input.nextInt();
		B = input.nextInt();
		C = input.nextInt();
		X = input.nextInt();
		
		for(int a = 0; a<=A;a++) {
			for(int b = 0; b<=B;b++) {
				for(int c = 0; c<=C;c++) {
					if((a*500 + b*100 + c*50) == X) count++;
				}
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

//#define DEBUG_MODE

int main() {
        ll N, K;
        cin >> N >> K;

        vector<ll> A(N+1, 0);
        FOR(i, 1, N+1) cin >> A[i];

        // before loop
        vector<ll> label(N+1, 0);
        ll n = 1;
        ll cnt = 0;
        while (K > 0) {
                if (label[n] != 0) {
                        break;
                }
                label[n] = cnt++;
                n = A[n];
		K -= 1;
#ifdef DEBUG_MODE
		cout << "[" << cnt << "]: " << n << endl;
#endif
        }

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

	// after loop
        ll loop_size = cnt - label[n];

	K %= loop_size;
	while (K) {
		n = A[n];
		--K;
	}

	cout << n << endl;
        return 0;
}

Measured memory_bytes: 6392
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a  = Integer.parseInt(sc.next());
        String str = sc.next();
        if(a % 2 == 1){
            System.out.println("No");
            System.exit(0);
        }
        String m = str.substring(a/2);
        if(str.substring(0,a/2).equals(m)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int main()
{
    bool first=true;
    while(1)
    {
        //input
        int m;
        cin >>m;
        if(m==0) break;

        int x[4];
        rep(i,4) cin >>x[i];

        int sum=100;
        int u[4]={500,100,50,10};
        int ans[4]={0};

        rep(a,x[0]+1)rep(b,x[1]+1)rep(c,x[2]+1)rep(d,x[3]+1)
        {
            //printf("%d,%d,%d,%d\n",a,b,c,d);
            int p=a*10+b*50+c*100+d*500-m;
            if(p<0) continue;

            int t[4]={0};
            int u[4]={500,100,50,10};
            rep(i,4)
            {
                int ct=0;
                while(p-u[i]>=0)
                {
                    ++ct;
                    p-=u[i];
                }
                t[i]=ct;
            }

            int tsum=0;
            tsum+=t[0]+x[0]-a;
            tsum+=t[1]+x[1]-b;
            tsum+=t[2]+x[2]-c;
            tsum+=t[3]+x[3]-d;

            if(tsum<sum)
            {
                sum=tsum;
                ans[0]=d;
                ans[1]=c;
                ans[2]=b;
                ans[3]=a;
            }

        }

        if(!first) printf("\n");
        for(int i=3; i>=0; --i)
        {
            if(ans[i]>0) printf("%d %d\n",u[i],ans[i]);
        }
        first=false;
    }
    return 0;
}

Measured memory_bytes: 3044
#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let mut a: usize = scn.read();
        let mut b: usize = scn.read();
        let mut c: usize = scn.read();
        let k: usize = scn.read();
        for _ in 0..k {
            if a >= b {
                b *= 2;
            } else if b >= c {
                c *= 2;
            }
        }
        if a < b && b < c {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
	
	int n;
	cin >> n;

	vector<int> a(n), b(n);

	for(int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}

	sort(a.rbegin(), a.rend());

	for(int i = 0; i < n; i++) {
		if(b[i] == a[0]) cout << a[1] << '\n';
		else cout << a[0] << '\n';
	}
    
    return 0;   
}

Measured memory_bytes: 3200
import sys

stdin = sys.stdin

n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))

n_2 = n
n_4 = n // 2
a_2 = 0
a_4 = 0

for i in a:
    if i % 4 == 0:
        a_4 += 1
    elif i % 2 == 0:
        a_2 += 1

if a_4 >= n_4 or a_2 >= n_2 or a_2 >= (n-a_4*2):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define rep(i, x) for (ll i = 0; i < (x); i++)

using namespace std;
typedef long long int ll;

// a b ... z  aa ab ac ... zz
// 0 1     25 26 27 28     701

int main(void) {
  ll N;
  cin >> N;
  N--;
  string ans;
  do {
    string t{'a' + (N % 26)};
    ans = t + ans;
    N /= 26;
    N--;
  } while (N >= 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        String first;
        char table[] = new char[20000];
 
        int M,h,left,right;
 
 
        try {
 
            while(!(first = br.readLine()).equals("-")){
 
                for(int i = 0; i < first.length(); i++){
                    table[i] = first.charAt(i);
                }
 
                left = 0;
                right = first.length()-1;
 
                M = Integer.parseInt(br.readLine());
 
                for(int loop = 0; loop < M; loop++){
                    h = Integer.parseInt(br.readLine());
 
                    for(int i = 0; i < h; i++){
                        table[right+1+i] = table[left+i];
                    }
                    left += h;
                    right += h;
                }
 
                for(int i = left; i <= right; i++){
                    System.out.printf("%c", table[i]);
                }
                System.out.printf("\n");
            }
 
 
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


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

using namespace std;

int main(){

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

    int sum = 0;
    for(int i = 0; i < n; i++){
	int a, b, x;
	cin >> x;
	a = (x - 0) * 2;
	b = abs(k - x) * 2;
	sum += (a > b) ? b : a;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import heapq
n, m = map(int, input().split())
A = list(map(lambda x:-x, map(int, input().split())))
heapq.heapify(A)
for i in range(m):
    mx = heapq.heappop(A)
    heapq.heappush(A,mx/2)
print(sum([int(-a) for a in A]))

Measured memory_bytes: 20388
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	static long power(int[] arr, int ticket){
		PriorityQueue<Integer> pq = new PriorityQueue(Collections.reverseOrder());
		for(int n : arr){
			pq.add(n);
		}
		while(ticket>0){
			int larg = pq.poll();
			larg >>= 1;
		//	System.out.println(larg);
			pq.add(larg);
			ticket -=1;
		}
		Integer val = 0;
		long ans = 0;
		while((val=pq.poll())!=null){
			ans += val;
		//	System.out.println(ans);
		}
		
		return ans;

	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
      int m = scan.nextInt();
      int ticket = scan.nextInt();
      int[] arr = new int[m];
      for(int i=0;i<m;i++){
        arr[i] = scan.nextInt();
      }
      System.out.println(power(arr,ticket));
		
		// your code goes here
	}
}

Measured memory_bytes: 55180
a1 = [int(e) for e in input().split()]
a2 = [int(e) for e in input().split()]
a3 = [int(e) for e in input().split()]
n = int(input())
bs = []
for _ in range(n):
    bs.append(int(input()))

def is_bingo(mat,hits):
    row_pattern = [[mat[i][j] for j in range(3)] for i in range(3)]
    col_pattern = [[mat[j][i] for j in range(3)] for i in range(3)]
    cross_patten= [[mat[i][i] for i in range(3)] , [mat[0][2],mat[1][1],mat[2][0]]]
    if any([set(pattern).issubset(hits) for pattern in row_pattern+col_pattern+cross_patten]):
        return True
    return False
  
m=[a1,a2,a3]
print('Yes' if is_bingo(m,bs) else 'No')

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

using namespace std;

typedef long long ll;

signed main()
{
    int h, w, x, y;
    cin >> h >> w >> x >> y;
    if((h * w) % 2 == 1 && (x + y) % 2 == 1)
        cout << "No" << endl;
    else {
        cout << "Yes" << endl;
    }
}



Measured memory_bytes: 3088
from bisect import bisect_left, bisect_right

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

ans = 0
# print(A)
# print(B)
# print(C)
for i in range(n):
    b = B[i]
    pos_a = bisect_left(A, b)
    pos_c = bisect_right(C, b)
    ans += pos_a * (n - pos_c)
    # print(b, pos_a, pos_c)
print(ans)


Measured memory_bytes: 29544
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+10;
const ll INF = 1LL<<60;
struct Nod {
	ll to, cost;
};
vector<Nod> G[N];
ll dist[N];
typedef pair<ll, ll> P;
void dij(ll x) {
	priority_queue<P, vector<P>, greater<P> > que;
	for(int i = 0; i < N; i ++) dist[i] = INF;
	dist[x] = 0;
	que.push(P(0, x));
	while(!que.empty()) {
		P p = que.top();
		que.pop();
		ll v = p.second;
		if(dist[v] < p.first) continue;
		for(ll i = 0; i < G[v].size(); i ++) {
			Nod e = G[v][i];
			if(dist[e.to] > dist[v] + e.cost) {
				dist[e.to] = dist[v] + e.cost;
				que.push(P(dist[e.to], e.to));
			}
		}
	}
}
int main() {
	int n, q, cnt = 0;
	scanf("%d", &n);
	for(int i = 0; i < n-1; i ++) {
		ll v, u, w;
		scanf("%lld %lld %lld", &v, &u, &w);
		G[v].push_back((Nod){u,w});
		G[u].push_back((Nod){v,w});
	}
 	ll k;
 	scanf("%d %lld", &q, &k);
 	dij(k);
 	while(q--) {
 		ll x, y;
 		scanf("%lld %lld", &x, &y);
 		printf("%lld\n",dist[x] + dist[y]);
 	}
	return 0;
}

Measured memory_bytes: 11120
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
char s[maxn],t[maxn];
int cnts[maxn],cntt[maxn];
int main(){
    scanf("%s",s+1);
    scanf("%s",t+1);
    memset(cnts,0,sizeof(cnts));
    memset(cntt,0,sizeof(cntt));
    int sn,tn;
    sn=strlen(s+1);
    tn=strlen(t+1);
    for(int i=1;i<=sn;i++){
        if(s[i]=='A'){
            cnts[i]+=cnts[i-1]+1;
        }
        else{
            cnts[i]=cnts[i-1];
        }
    }
    for(int i=1;i<=tn;i++){
        if(t[i]=='A'){
            cntt[i]+=cntt[i-1]+1;
        }
        else{
            cntt[i]=cntt[i-1];
        }
    }
    int q;
    cin>>q;
    int a,b,c,d;

    for(int i=1;i<=q;i++){
        scanf("%d%d%d%d",&a,&b,&c,&d);
        sn=2*(cnts[b]-cnts[a-1])+b-a+1-(cnts[b]-cnts[a-1]);
        tn=2*(cntt[d]-cntt[c-1])+d-c+1-(cntt[d]-cntt[c-1]);
   
        if(abs(sn-tn)%3==0){
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }
    }
//    system("pause");
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  int x,y;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      string a;
      cin>>a;
      if(a=="snuke")x=i,y=j;
    }
  }
  cout<<(char)('A'+y)<<x+1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    ll N; cin >> N;

    if (N < 10) {
        cout << N << endl;
    } else {
        ll t = 9;
        ll ans = 9;
        ll base = 10;
        while (true) {
            if (t * 10 + 9 <= N) {
                t = t * 10 + 9;
                ans += 9;
                base *= 10;
            } else {
                break;
            }
        }
        while (true) {
            if (t + base <= N) {
                ans ++;
                t += base;
            } else {
                break;
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
s = input()

counter = 0
max_count = 0

for str_i in range(len(s)):
  
  if s[str_i] in ['A', 'C', 'G', 'T']:
    counter += 1
  else:
    max_count = max(max_count, counter)
    counter = 0

max_count = max(max_count, counter)
print(max_count)

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, M;
	cin >> N >> M;
	vector<int>a(N);
	int first = 1, L = 1;
	rep(i, N)
	{
		cin >> a[i];
		first = lcm(first, a[i]);
		L = lcm(L, a[i] / 2);
		if (L > M)
		{
			cout << 0;
			return 0;
		}
	}
	rep(i, N)
	{
		if ((L / (a[i] / 2)) % 2 == 0)
		{
			cout << 0;
			return 0;
		}
	}
	int ans = (M - L) / first + 1;
	cout << ans;
}

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

const string d = "LURD";

int main() {
  int h, w, n, sr, sc;
  vector<string> s(2);
  cin >> h >> w >> n >> sr >> sc >> s[0] >> s[1];
  vector<int> l = {sc - 1, sr - 1, w - sc, h - sr};

  // for (auto e : l) cerr << e << " ";
  // cerr << endl;

  vector<vector<vector<int>>> v(n + 1, vector<vector<int>>(4, vector<int>(2)));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 2; k++) {
        v[i + 1][j][k] = v[i][j][k] + (s[k][i] == d[j]);
      }
    }
    for (int j = 0; j < 4; j++) {
      v[i + 1][j][1] = min(v[i + 1][j][1], v[i + 1][(j + 2) % 4][0] + l[j]);

      // cerr << v[i + 1][j][0] << " " << v[i + 1][j][1] << ", ";
    }
    // cerr << endl;
  }

  bool r = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      r &= v[i + 1][j][0] - v[i][(j + 2) % 4][1] <= l[j];
    }
  }
  cout << (r ? "YES" : "NO") << endl;
}


Measured memory_bytes: 52232
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template <class T> void read(T &);
template <class T> void write(const T &);

typedef long long ll;
typedef unsigned long long ull;
typedef const long long &cll;
typedef const int &ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::abs;
using std::max;
using std::min;

const int N = 2005;
const int Mod = 1000000007;

int S[N];
int n;

int main() {
  read(n);
  S[0] = 1;
  int sum = 0;
  for (int i = 3; i <= n; ++i) {
    sum = (sum + S[i - 3]) % Mod;
    S[i] = sum;
  }
  write(S[n]), EL;
  return 0;
}

template <class T> inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template <class T> inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n,d[100],num[101],c=0;
	cin>>n;
	for(int i=1;i<=100;i++)num[i]=0;
	for(int i=0;i<n;i++){
		cin>>d[i];
		num[d[i]]=1;
	}
	for(int i=1;i<=100;i++){
		if(num[i]==1)c++;
	}
	cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Main main = new Main();
		main.solveE();
	}

	private void solveE() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		long[] sumArr = new long[N + 1];
		sumArr[0] = 0L;
		List<Long> sumList = new ArrayList<Long>();
		sumList.add(sumArr[0]);
		for (int i = 1; i <= N; i++) {
			sumArr[i] = sumArr[i - 1] + sc.nextLong() - K;
			sumList.add(sumArr[i]);
		}
		Collections.sort(sumList);
		int current = 0;
		Map<Long, Integer> map = new HashMap<>();
		for (long value : sumList) {
			map.put(value, current++);
		}
		long ans = 0L;
		BinaryIndexedTree bit = new BinaryIndexedTree(N + 1);
		for (int i = 0; i <= N; i++) {
			int pos = map.get(sumArr[i]);
			ans += bit.getSum(pos);
			bit.addNum(1, pos);
		}
		System.out.println(ans);
	}

	class BinaryIndexedTree {
		int N;
		int[] arr;
		public BinaryIndexedTree(int N) {
			arr = new int[N];
			this.N = N;
		}

		/**
		 * posで指定した位置にval加算する
		 * @param val 加算する値
		 * @param pos 加算する位置
		 */
		public void addNum(int val, int pos) {
			while (pos < N) {
				arr[pos] += val;
				pos += (pos+1)&(-pos-1);
			}
		}

		/**
		 * posで指定した位置までの和を取得する
		 * @param pos 和を取得する位置
		 * @return 0～posの和
		 */
		public int getSum(int pos) {
			int sum = 0;
			while (pos >= 0) {
				sum += arr[pos];
				pos -= (pos+1)&(-pos-1);
			}
			return sum;
		}
	}
}

Measured memory_bytes: 101356
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int n;
  cin>>s;
  n=s.size()-1;
  if(s[n]=='s'){
    cout<<s<<"es"<<endl;
  }
  else
    cout<<s<<"s"<<endl;
  return 0;
}


Measured memory_bytes: 3620
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int[] a = Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();

		int M = 0;
		var sb = new StringBuilder();
		if(a.All(x => x >= 0))
		{
			M = N - 1;
			for(int i = 0; i < N - 1; i++)
				sb.AppendFormat($"{i + 1} {i + 2}\n");
		}
		else if(a.All(x => x < 0))
		{
			M = N - 1;
			for(int i = N - 2; i >= 0; i--)
				sb.AppendFormat($"{i + 2} {i + 1}\n");
		}
		else
		{
			M = 2 * N - 2;			
			int aMin = a.Min();
			int iMin = Array.FindIndex(a, x => x == aMin);
			int aMax = a.Max();
			int iMax = Array.FindIndex(a, x => x == aMax);

			if(aMax >= - aMin)
			{
				for(int i = 0; i < N; i++)
					if(i != iMax)
						sb.AppendFormat($"{iMax + 1} {i + 1}\n");

				for(int i = 0; i < N - 1; i++)
					sb.AppendFormat($"{i + 1} {i + 2}\n");
			}
			else
			{
				for(int i = 0; i < N; i++)
					if(i != iMin)
						sb.AppendFormat($"{iMin + 1} {i + 1}\n");

				for(int i = N - 2; i >= 0; i--)
					sb.AppendFormat($"{i + 2} {i + 1}\n");
			}
		}

		Console.WriteLine(M);
		Console.Write(sb);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
}


Measured memory_bytes: 13396
import sys
import math


#0:中央 1:南 2:東 3:西 4:北 5:裏側
class Dice():

    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'

    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5


    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]

        if loc == 'E':
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])


    def query(self,top_num,front_num):

        self.save_data = [i for i in range(6)]
        #元の値の保存
        for i in range(len(self.number)):
            self.save_data[i] = self.number[i]

        ret = -1

        for i in range(len(self.order)):
            self.roll(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break

        #元の値の復元
        for i in range(len(self.number)):
            self.number[i] = self.save_data[i]

        return ret

    def equals(self,another):

        ret = False

        for i in range(len(self.order)):
            self.roll(self.order[i])
            FLG = True
            for k in range(6):
                if self.number[k] != another.number[k]:
                    FLG = False
                    break
            if FLG == True:
                return True

        return ret

diceA = Dice()
diceB = Dice()

table = list(map(int,input().split()))
diceA.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])

table = list(map(int,input().split()))
diceB.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])

if diceA.equals(diceB):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5680
class Dice:
  def make_dice(self, value):
    self.face = value
  def move(self, direc):
    if direc == "N":
      self.face = [self.face[1], self.face[5], self.face[2], self.face[3], self.face[0], self.face[4]]
      return self.face
    elif direc == "E":
      self.face = [self.face[3], self.face[1], self.face[0], self.face[5], self.face[4], self.face[2]]
      return self.face
    elif direc == "S":
      self.face = [self.face[4], self.face[0], self.face[2], self.face[3], self.face[5], self.face[1]]
      return self.face
    elif direc == "W":
      self.face = [self.face[2], self.face[1], self.face[5], self.face[0], self.face[4], self.face[3]]
      return self.face
  def check_face(self, face1):
    for i in range(4):
      if face1 == self.face:
        return self.face
      else:
        self.face[1],self.face[2],self.face[4],self.face[3] = self.face[2],self.face[4],self.face[3],self.face[1]

num1 = list(map(int, input().split()))
num2 = list(map(int, input().split()))
dice1 = Dice()
dice2 = Dice()
dice1.make_dice(num1)
for i in range(6):
  dice2.make_dice(num2)
  if i == 0:
    dice2.check_face(dice1.face)
    if dice1.face == dice2.face:
      print("Yes")
      break
  elif i == 1:
    dice2.move("N")
    dice2.check_face(dice1.face)
    if dice1.face == dice2.face:
      print("Yes")
      break
  elif i == 2:
    dice2.move("E")
    dice2.check_face(dice1.face)
    if dice1.face == dice2.face:
      print("Yes")
      break
  elif i == 3:
    dice2.move("S")
    dice2.check_face(dice1.face)
    if dice1.face == dice2.face:
      print("Yes")
      break
  elif i == 4:
    dice2.move("W")
    dice2.check_face(dice1.face)
    if dice1.face == dice2.face:
      print("Yes")
      break
  elif i == 5:
    dice2.move("N")
    dice2.move("N")
    dice2.check_face(dice1.face)
    if dice1.face == dice2.face:
      print("Yes")
      break
    else:
      print("No")
      break


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

using namespace std;

int main() {
    int n , k; cin>>n>>k;
    vector<int>v(n);
    for(int& i : v)cin>>i;
    sort(v.begin(), v.end());
    long long s = 0;
    int d = n - k;
    if(d <= 0){
        cout<<0<<endl;
        return 0;
    }
    for(int i = 0 ; i < d; ++i)s += v[i];
    cout<<s<<endl;

}

Measured memory_bytes: 1024
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X, N = mapint()
Ps = set(list(mapint()))
now = X
for i in range(1000):
    if not now-i in Ps:
        print(now-i)
        break
    if not now+i in Ps:
        print(now+i)
        break



Measured memory_bytes: 9184
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    string s, p;
    cin>>s>>p;

    s = s + s;
    int l = p.size();
    bool f = false;
    rep(i, s.size()) {
        if (s.substr(i, l) == p) {
            cout<<"Yes"<<endl;
            f = true;
            break;
        }
    }
    if (!f) cout<<"No"<<endl;
}


Measured memory_bytes: 3228
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>

using namespace std;

int a[4];

string ans;

string re(string s, int n, int cnt){
    if(cnt == 4){
        if(n == 7){
            return s;
        }else{
            return "";
        }
    }else{
        string s1 = re(s + "+", n + a[cnt], cnt + 1);
        string s2 = re(s + "-", n - a[cnt], cnt + 1);
        if(s1.size() >= s2.size()){
            return s1;
        }else{
            return s2;
        }
    }
}

int main(){
    string s;
    cin >> s;
    for(int i = 0; i < 4; i++){
        a[i] = s[i] - '0';
    }
    ans = re("", a[0], 1);
    cout << a[0] << ans[0] << a[1] << ans[1] << a[2] << ans[2] << a[3] << "=7";
    
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<ctime>
using namespace std;
typedef long long lt;
typedef double dd;
#define eps 1e-6
#define sqr(x) ((x)*(x))

int read()
{
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

const int maxn=1000010;
int n;
struct point{dd x,y;}p[maxn],O;
dd R;

dd getd(point a,point b){ return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
point getO(point p1,point p2,point p3)
{
    point res;
    dd a=p2.x-p1.x,b=p2.y-p1.y,c=p3.x-p2.x,d=p3.y-p2.y;
    dd e=sqr(p2.x)+sqr(p2.y)-sqr(p1.x)-sqr(p1.y);
    dd f=sqr(p3.x)+sqr(p3.y)-sqr(p2.x)-sqr(p2.y);
    res.x=(f*b-e*d)/(c*b-a*d)/2.0; 
    res.y=(a*f-e*c)/(a*d-b*c)/2.0;
    return res;
}

void mincir()
{
    O=p[1]; R=0;
    for(int i=1;i<=n;++i)
    if(getd(p[i],O)-R>eps)
    {
        O=p[i]; R=0;
        for(int j=1;j<i;j++)
        if(getd(p[j],O)-R>eps)
        {
            O=(point){(p[i].x+p[j].x)/2.0,(p[i].y+p[j].y)/2.0};
            R=getd(p[i],p[j])/2.0;
    
            for(int k=1;k<j;++k)
            if(getd(p[k],O)-R>eps)
            {
                O=getO(p[i],p[j],p[k]);
                R=getd(p[i],O);
            }
        }
    }
} 

int main()
{
    n=read();
    for(int i=1;i<=n;++i)
    scanf("%lf%lf",&p[i].x,&p[i].y);
    
    random_shuffle(p+1,p+1+n);
    
    mincir();
    printf("%.9lf",R);
    return 0;
}

Measured memory_bytes: 256
#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,a,b) for(int i=(int)(a-1);i>=b;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 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;

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    a += b;
    if (a % 2) a++;
    cout << a / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
bool mp[7][7];
int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int h, w, x;
  cin >> h >> w >> x;
  int tot = 0;
  FOR(i, 0, h - 1) {
    string S;
    cin >> S;
    FOR(j, 0, w - 1) {
      mp[i][j] = (S[j] == '#');
      tot += mp[i][j];
    }
  }
  int ans = 0;
  FOR(i, 0, (1 << h) - 1) {
    FOR(j, 0, (1 << w) - 1) {
      int cnt = 0;
      FOR(k, 0, h) {
        FOR(l, 0, w) {
          cnt += mp[k][l] & (((i >> k) & 1) | ((j >> l) & 1));
        }
      }
      ans += (cnt + x == tot);
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.1416
#define f(i,l,r) for(int i=l;i<=r;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{

    ll int i,j,k,sum=0,x,n,p,q,r,a,b;

cin>>a>>b;

    p=a%b;
    q=abs(p-b);
    if(q<=p)
        cout<<q<<endl;
    else
        cout<<p<<endl;






return 0;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n,a,b;cin>>n>>a>>b;
    vector<ll> x(n);
    rep(i,n) cin>>x[i];
    ll res=0;
    rep(i,n-1){
        ll d=x[i+1]-x[i];
        if(d*a>b) res+=b;
        else res+=d*a;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
count = 0
for i in range (0,n):
    count += b[i]
for j in range (0,n-1):
    if (a[j+1]-a[j] == 1):
        count += c[a[j]-1]
print(count)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(){
  char s[20];

  scanf("%s", s);

  for(int cnt = 0; cnt < 19; cnt++){
    if(s[cnt] != ','){
      printf("%c", s[cnt]);
    }else{
      printf(" ");
    }

  }
  printf("\n");
  
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <queue>
#define ll long long int
#define inf 3e18+1
#define all(v) (v).begin(),(v).end() 
#define N 200005
#define F first
#define S second
using namespace std;
ll mod=1e9+7;
int main()
{
    // added the two lines below 
    ios_base::sync_with_stdio (false); 
    cin.tie(NULL);
    cout.tie(0);    
    ll test=1;//cin>>test;
    while(test--){
        ll n;
        cin>>n;
        vector<pair<ll,ll>>v(n);
        int f=0;
        for(int i=0;i<n;i++) cin>>v[i].F>>v[i].S;
        for(int i=0;i<n-2;i++){
            if(v[i].F==v[i].S and v[i+1].F==v[i+1].S and v[i+2].F==v[i+2].S) {
                f=1;
                break;
            }
        }
        if(f) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;

    }
    return 0;
}




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

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

  int m = abs(x - a);
  int n = abs(x - b);
  if (m > n) {
    cout << "B" << endl;
  } else {
    cout << "A" << endl;
  }
}


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

int main(void){
  int k,n;
  cin >> k >> n;
  vector<int> a(n);
  int i;
  for(i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  int m=0;
  
  for(i=0;i<n-1;i++){
    if(m<a.at(i+1)-a.at(i)){
      m=a.at(i+1)-a.at(i);
    }
  }
  
  if(m<k-a.at(n-1)+a.at(0)){
    m=k-a.at(n-1)+a.at(0);
  }
  
  cout << k-m << endl;
}

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

#define SZ(x) ((int(x.size())))

using namespace std;

const int maxn = 110;
int M, n, t[maxn], x;

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		t[x]++;
		if (x > M)
			M = x;
	}
	if (M % 2 == 0)
	{
		if (t[M / 2] == 0)
		{
			cout << "Impossible";
			return 0;
		}
		else
			t[M / 2]--;
	}
	for (int i = M / 2 + 1; i <= M; i++)
	{
		if (t[i] < 2)
		{
			cout << "Impossible";
			return 0;
		}
		else
			t[i] -= 2;
	}
	for (int i = 1; i <= (M + 1) / 2; i++)
	{
		if (t[i] > 0)
		{
			cout << "Impossible";
			return 0;
		}
	}
	cout << "Possible";
	return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<long long> x(N), y(N), z(N);
    for(int i=0; i<N; i++) cin >> x[i] >> y[i] >> z[i];
    int a[8] = {1, 1, 1, 1, -1, -1, -1, -1};
    int b[8] = {1, 1, -1, -1, 1, 1, -1, -1};
    int c[8] = {1, -1, 1, -1, 1, -1, 1, -1};

    long long ans = 0;
    for(int i=0; i<8; i++){
        long long tmp = 0;
        vector<long long> w(N);
        for(int j=0; j<N; j++)
            w[j] = a[i]*x[j] + b[i]*y[j] +c[i]*z[j];
        sort(w.begin(), w.end(), greater<long long>());
        for(int j=0; j<M; j++)
            tmp += w[j];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8



int main(){
	LL a, b, c, d, e, f;
	LL x, y, z;
	double p, q, r;
	string s = "a", t, u;
	
	a = b = c = d = e = f = 0;
	x = y = z = 0;
	p = q = r = 0.0;
	
	cin >> a >> b >> c >> d >> e >> f;
	cin.clear();
	cin >> s >> t >> u;
	cin.clear();
	
	puts(c >= a && c <= b ? "Yes" : "No");
}


Measured memory_bytes: 764
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cctype>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(k,a,b) for(int k=(a); k < (b); k++)
#define FORE(k,a,b) for(int k=(a); k <= (b); k++)
#define REP(k,a) for(int k=0; k < (a); k++)

#define ALL(c) (c).begin(), (c).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define RANGE(lb, x, ub) ((lb) <= (x) && (x) < (ub))

#define dump(x) cerr << #x << ": " << (x) << endl;

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INF = 1000000000;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main(void) {
    int n, k; cin >> n >> k;
    VI vs(n); REP(i, n) cin >> vs[i];

    int ret = 0;
    FORE(i, 1, min(n, k)) {
      FORE(k1, 0, i) {
        VI jewels;
        REP(j, k1) jewels.push_back(vs[j]);
        REP(j, i - k1) jewels.push_back(vs[n-1-j]);

        sort(ALL(jewels));
        FORE(x, 0, min(i, k - i)) {
          ret = max(ret, accumulate(jewels.begin() + x, jewels.end(), 0));
        }
      }
    }

    cout << ret << endl;

    return 0;
}


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

using namespace std;

int main()
{
    int x, y;
    while (true)
    {
        cin >> x >> y;
        if (x == 0 && y == 0)
        {
            break;
        }

        if (x > y)
        {
            int temp = x;
            x = y;
            y = temp;
        }

        cout << x << " " << y << endl;
    }

    return 0;
}


Measured memory_bytes: 3016
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt(), M = scn.nextInt();
		boolean AC[] = new boolean[N];
		int WA[] = new int[N];
		int ac = 0;
		int wa = 0;
		for(int i = 0;i < M;i++) {
			int p = scn.nextInt();
			char[] s = scn.next().toCharArray();
			if(s[0] == 'A') {
				AC[p-1] = true;
			}else {
				if(!AC[p-1]) {
					WA[p-1]++;
				}
			}
		}
		for(int i = 0;i < N;i++) {
			if(AC[i]) {
				ac++;
				wa += WA[i];
			}
		}
		System.out.println(ac + " " + wa);
	}

}


Measured memory_bytes: 64476
fn main(){
    let li:Vec<i32> = getline().trim().split(' ').map(|e| e.parse().unwrap()).collect();
    let n = li[0];
    let mut x = li[1];
    let mut m:Vec<i32> = (0..n).map(|_| getline().trim().parse().unwrap()).collect();
    
    let mut total = n;
    let t:i32 = m.iter().sum();
    x -= t;
    total += x / m.iter().min().unwrap();
    
    println!("{}", total);
}

fn getline() -> String{
    let mut r = String::new();
    std::io::stdin().read_line(&mut r).ok();
    return r;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll x, y;
  cin >> x >> y;
  if((x>=0 and y>0) or (x<0 and y<=0)) {
    if(x<=y) cout << y-x;
    else cout << x-y+2;
  }else cout << abs(x+y)+1;
  cout << newl;
  return 0;
}

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

int main()
{
    ll n;
    ll a[100007];
    ll b[100007];
    cin >> n;
    for (ll i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    ll ans = 0;
    for (ll i = n - 1; i >= 0; i--) {
        ans += ((b[i] - (a[i] + ans) % b[i])) % b[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
long long
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 回数 - 取得
	int liCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liCnt);

	// 最大値 - 取得
	long long llMax = 2;
	for (i = 0; i < liCnt; i++) {
		llMax = (llMax + 1) * 2;
	}

	return llMax;
}

// １回実行
int
fOne(
)
{
	long long llRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	llRet = fMain();

	// 出力
	sprintf(lc1Buf, "%lld\n", llRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define INV  500000004LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
 
#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 1005
int h, w, a, b;

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

    cin >> h >> w >> a >> b;

    FOR(i, 1, h){
        FOR(j, 1, w){
            if((i<=b)==(j<=a)){
                cout << "1";
            } else{
                cout << "0";
            }
        }
        cout << "\n";
    }

    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9+5;
int main() {
    
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n;
    cin >> n;
    ll W;
    cin >> W;
    vector<int> w(n+1);
    vector<int> v(n+1);
    for (int i=1; i<=n; i++) {
        cin >> w[i];
        cin >> v[i];
    }
    ll sum_value = 0;
    for (int i=1; i<=n; i++) {
        sum_value += v[i];
    }
    const ll INF = 1e18l+5;
    ll dp[n+1][sum_value+1];
    for (int i=0; i<=n; i++) {
        for (int j=0; j<=sum_value; j++) {
            dp[i][j] = INF;
        }
    }
    for (int i=0; i<=n; i++) {
        dp[i][0] = 0;
    } 
    dp[0][0] = 0;
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=sum_value; j++) {
            if (v[i]<=j)
                dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i]]+w[i]);
            else
                dp[i][j] = dp[i-1][j];
            //cout << dp[i][j] << " " << j << endl;
        }
    }
    /*for (int i=0; i<=n; i++) {
        for (int j=0; j<=sum_value; j++) {
            if (dp[i][j] == INF)
                cout << "I" << " ";
            else
                cout << dp[i][j] << " ";
        }
        cout << endl;
    }*/
    ll ans = 0;
    for (int i=1; i<=sum_value; i++) {
        if (dp[n][i] <= W)
            ans = max(ans, (ll)i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 79232