akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          char[] s = Input.ScanStr().ToCharArray();
          Array.Sort(s);
          Console.WriteLine(new string(s)=="abc" ? "Yes" : "No");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[10000]={0},b[10000]={0};
cin>>a>>b;
for(int i=0;i<max(strlen(a),strlen(b));i++)
{
if(a[i]!=0) cout<<a[i];
if(b[i]!=0) cout<<b[i];
}
return 0;
}

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

int main(){
 int n,m,x,y,a,b,amax,bmin;
  cin>>n>>m>>x>>y;
amax=-1000000;
  bmin=1000000;
  for(int i=0;i<n;i++){
    cin>>a;
    amax=max(a,amax);
  }
  for(int i=0;i<m;i++){
    cin>>b;
    bmin=min(b,bmin);
  }
    if(amax>=bmin){
   cout<<"War"<<endl;
  }
  else{
    for(int i=amax;i<bmin+1;i++){
    if(i>x&&i<y){
      cout<<"No"<<" "<<"War"<<endl;
      break;
    }
      if(i==bmin){
        cout<<"War"<<endl;
        break;
      }
    }
  }


}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    static boolean[][] used;
    static int[] ans;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char[] s = sc.next().toCharArray();
        int st0 = 0;
        int st1 = 0;
        int len = s.length;
        for(int i = 0; i < len; i++){
            char c = s[i];
            if(i % 2 == 0){
                if(s[i] == '0') st1++;
                if(s[i] == '1') st0++;
            }else{
                if(s[i] == '0') st0++;
                if(s[i] == '1') st1++;
            }
        }
        System.out.println(Math.min(st0,st1));
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


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

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

    long long count = 0;
    for(long long i = a; i <= b; i++){
        string s = to_string(i);
        string s_r = s;
        reverse(s.begin(), s.end());

        if(s_r == s){
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		for(int i=0;i<10;i++) {
			System.out.println(n*c-b);
			c=n*c-b;
		}

	}
}




Measured memory_bytes: 22996
import java.util.Scanner;


class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   String s = sc.next();
   String t = sc.next();
   int count=0;
   
   for(int i=0;i<s.length();i++){
    if((s.charAt(i))==(t.charAt(i))){
   count++;
    }
   }

   
     System.out.println(s.length()-count);
   
 
 }
}


Measured memory_bytes: 41180
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int N = Integer.parseInt(br.readLine());
		int[] X = new int[N];
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<N; i++)
			X[i] = Integer.parseInt(st.nextToken());
		
		int min = Integer.MAX_VALUE;
		
		for(int p=1; p<100; p++) {
			int ans = 0;
			for(int i=0; i<N; i++)
				ans += (int)Math.pow(X[i] - p, 2);
			min = Math.min(ans, min);
		}
		
		System.out.println(min);
	}

}

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

using namespace std;


int main()
{
	string s,t; cin >> s >> t;
	vector<vector<int>> dp(s.size()+1, vector<int>(t.size()+1));

	for(int i = 1; i <= (int)s.size(); i++){
		for(int j = 1; j <= (int)t.size(); j++){
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1]+1;
			}else{
				if(dp[i-1][j] > dp[i][j-1]){
					dp[i][j] = dp[i-1][j];
				}else{
					dp[i][j] = dp[i][j-1];
				}
			}
		}
	}
	string ans = "";
	int i = s.size(), j = t.size();
	while(i > 0 && j > 0){
		if(s[i-1] == t[j-1]){
			ans += s[i-1];
			i--; j--;
		}
		else if(dp[i-1][j] > dp[i][j-1]){
			i--;
		}else j--;
	}
	reverse(ans.begin(), ans.end());
	cout << ans;
}


Measured memory_bytes: 38544
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1001

struct BipartiteMatching{
  
  int V;
  vector<vector<int> > G;
  vector<int> match;
  vector<bool> used;
  
  BipartiteMatching(int n):
    V(n),G(n,vector<int>()){}
  
  void add_edge(int u, int v){
    G[u].push_back(v);
    G[v].push_back(u);
  }
  
  bool dfs(int v){
    used[v] = true;
    for(int i=0;i<G[v].size();i++){
      int u = G[v][i], w = match[u];
      if(w < 0 || (!used[w] && dfs(w))){
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }
  
  int solve(){
    int res = 0;
    match.assign(V,-1);
    for(int i=0;i<V;i++){
      if(match[i] < 0){
        used.assign(V,false);
        if(dfs(i)) res++;
      }
    }
    
    return res;
  }
  
};



int main(){
  int x,y,e;

  scanf("%d%d%d",&x,&y,&e);

  BipartiteMatching bip(x+y);

  for(int i=0;i<e;i++){
    int a,b;

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

    bip.add_edge(a,b+x);
  }

  printf("%d\n",bip.solve());
  
  return 0;
}

Measured memory_bytes: 3364
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N;
	cin >> N;

	int A[200000];
	rep(i, N) cin >> A[i];

	map<int, int> MP;

	rep(i, N) {
		MP[i + A[i]]++;
	}

	ll kotae = 0;
	rep(i, N) {
		int tmp = i - A[i];
		kotae += MP[tmp];
	}

	co(kotae);

	Would you please return 0;
}

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

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

    if(a.size()>b.size())cout<<"GREATER"<<endl;
    else if(a.size()<b.size())cout<<"LESS"<<endl;
    else {
        for(int i=0;i<a.size();i++){
            if(a[i]==b[i]&&i!=a.size()-1)continue;
            if(a[i]>b[i]){
                cout<<"GREATER"<<endl;
                break;
            }else if(a[i]<b[i]){
                cout<<"LESS"<<endl;
                break;
            }
            cout<<"EQUAL"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3640
/*                                                                                 
	Author :- Gaurang_Kothiya
	
	Quote :- " Practice makes a man perfect. "		
*/  
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  
 
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define f(i,x,n) for(auto i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(auto i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
const ll inf= 1e9;
const ll inf64= 1e18;
const ll MOD= 1e9 +7;



void Solve()
{
	int a[6];
	f(i,1,5) cin>>a[i];
	f(i,1,5) if(a[i]==0)
	{
		cout<<i;
		return;	
	}	
} 
 
signed main() 
{
	speed		
	
	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
	
	return 0;
} 

Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> data(N);
    for (int i = 0; i < N; i++) {
        cin >> data.at(i);
    }
    vector<int> ans(N);
    for (int i = 0; i < N; i++) {
        ans.at(data.at(i) - 1) = i + 1;
    }
    for (int x : ans) {
        cout << x << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1536
// organize and work - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void q1(){
	int r;
	cin>>r;
	cout<<r*r;
}
void q2(){
	int n; cin>>n;
	if(n&1){
		cout<<"No\n";
		return ;
	}
	n/=2;
	string s;
	cin>>s;
	int fg=1;
	for(int i=0;i<n;++i)
	if(s[i]!=s[i+n])
	fg=0;
	fg==1 ? cout<<"Yes\n" : cout<<"No\n";
}
void q3(){
	int n;
	cin>>n;
	int x[n],y[n];
	for(int i=0;i<n;++i)
	cin>>x[i]>>y[i];
	double tp=0;
	for(int i=0;i<n;++i)
	for(int j=i+1;j<n;++j)
	tp+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
	tp*=2;	tp/=n;
	cout<<fixed<<setprecision(10)<<tp;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t=1;
	while(t--)
	q3();
	return 0;
}
	


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter};
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = [$(&stringify!([$arg]:), &$arg as &Debug),*];
            stderr().write_fmt(format_args!("{:#?}\n", entries)).unwrap();
        }
    };
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

// -----------------------------------------------
// Solution
// -----------------------------------------------

pub fn main() {
    let (N, K) = read!(usize, usize);
    let A = read![[usize]];

    println!("{}", 1 + (N - K + (K - 2)) / (K - 1));
    return;
}


Measured memory_bytes: 6396
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const ll maxn=1e18+1;
#define M 13
// int A[M];
ll dp[M][M],st[M];
int qt[M];
inline void rd(int &l){
	l=0;int f=0;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch>='0'&&ch<='9'){l=l*10+ch-'0';ch=getchar();}
	if(f)l=-l;
}
ll sol(int n,int k){
	// printf("n %d k %d\n",n,k);
	ll ans=0;
	int ct=1;
	for(int i=1;i<=9;++i)if(n>dp[k][i]){n-=dp[k][i];}else{ans=qt[k]=i;break;}
	// printf("n %d\n",n);
	--k;
	while(k){
		ans*=10;
		for(int i=max(0,qt[k+1]-1);i<=min(9,qt[k+1]+1);++i)if(n>dp[k][i]){n-=dp[k][i];}else{ans+=i;qt[k]=i;break;}
		--k;
	}
	return ans;
}
int main(){
	for(int i=0;i<10;++i)dp[1][i]=1;
	for(int i=2;i<=10;++i){
		for(int j=0;j<10;++j){
			if(j)dp[i][j]+=dp[i-1][j-1];
			dp[i][j]+=dp[i-1][j];
			if(j!=9)dp[i][j]+=dp[i-1][j+1];
			if(j)st[i]+=dp[i][j];
			// printf("dp[%d][%d]=%lld\n",i,j,dp[i][j]);
		}
		// printf("st[%d]=%lld\n",i,st[i]);
	}
	st[1]=9;
	int n;
	rd(n);
	if(n<10)printf("%d\n",n);
	else{
		n-=st[1];
		for(int i=2;i<=10;++i)
			if(n<=st[i]){printf("%lld\n",sol(n,i));break;}
			else n-=st[i];
	}
	// getchar();
	// getchar();
	return 0;
}

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

int main() {
	int ajyo,asu,ari,aei,bjyo,bsu,bri,bei;
	cin>>ajyo>>asu>>ari>>aei>>bjyo>>bsu>>bri>>bei;
	if(ajyo+asu+ari+aei<bjyo+bsu+bri+bei){
		cout<<bjyo+bsu+bri+bei<<endl;
	}
	else if(ajyo+asu+ari+aei>bjyo+bsu+bri+bei){
		cout<<ajyo+asu+ari+aei<<endl;
	}
	else{
		cout<<bjyo+bsu+bri+bei<<endl;
	}
	return 0;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (getline(cin, s), s != "END OF INPUT") {
		string ans;
		int cnt('0');
		rep(i, 0, s.size()) {
			if (s[i] == ' ') {
				ans.push_back(cnt);
				cnt = '0';
			}
			else cnt++;
		}
		ans.push_back(cnt);
		cout << ans << endl;
	}
	return 0;
}

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

int main(){

    long long A, B, C;
    cin >> A >> B >> C;

    long long sufa, sufb, sufc, suf;
    sufc = A*B;
    if(C%2==0) sufc = 0;

    sufb = C*A;
    if(B%2==0) sufb = 0;

    sufa = B*C;
    if(A%2==0) sufa = 0;

    suf = min(sufa, min(sufb, sufc));
    cout << suf << endl;
    return 0;
}

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

int main(){
  long long int N;
  cin>>N;
  vector<long long int> A(N);
  for(long long int i=0;i<N;i++)cin>>A.at(i);
  sort(A.begin(),A.end());
  bool flag=true;
  for(long long int i=1;i<N;i++)
    if(A.at(i-1)==A.at(i))flag=false;
  if(flag)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  int i=0, j=0, v[n], c[n], d[n];
  while(n > i){
    cin >> v[i];
    i++;
  }
  while(n > j){
    cin >> c[j];
    j++;
  }
  for(i = 0; i < n; i++){
    d[i] = v[i] - c[i]; //difference between value and cost
  }

  int sum = 0;
  for(i = 0; i < n; i++){
    if(d[i] > 0){
      sum += d[i];
    }
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    s = list(input())

    ans = 0
    for i in range(n-2):
        abc = str(s[i]) + str(s[i+1]) + str(s[i+2])
        if abc == "ABC":
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0]);
  var ans="111";
  if(n<=111){
  }else if(n>=112&&n<=222){
    ans="222";
  }else if(n<=333){
    ans="333";
  }else if(n<=444){
    ans="444";
  }else if(n<=555){
    ans="555";
  }else if(n<=666){
    ans="666";
  }else if(n<=777){
    ans="777";
  }else if(n<=888){
    ans="888";
  }else{
    ans="999";
  }
  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
  long long a,b,c,d;
  cin>>a>>b>>c>>d;
  long long ans;
  ans = max(a*c, b*d);
  ans = max(ans, a*d);
  ans = max(ans, b*c);
  cout<<ans<<endl;
  return 0;
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)

signed main() {
  i64 n, p, q;
  cin >> n >> p >> q;
  vector<i64> C(n);
  vector<i64> D(n);
  i64 sum = 0;
  REP(i, n) {
    cin >> C[i];
    sum += C[i];
    D[i] = p * (q - i) - C[i];
  }
  sort(D.begin(), D.end(), greater<i64>());
  i64 ans = sum;
  i64 tmp = sum;
  REP(i, n) {
    tmp += D[i] + 2 * p * i;
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}



Measured memory_bytes: 10756
def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    res = 1
    for x in a:
        if x == 0:
            print(0)
            return
    for x in a:
        res *= x
        if res > int(1e18):
            print(-1)
            return
    print(res)


solve()


Measured memory_bytes: 21708
N = int(input())
ps = [list(map(int, input().split())) for _ in range(N)]

prev = None
for x, y in ps:
  mandist = abs(x) + abs(y)
  if prev is not None and mandist % 2 != prev:
    print('-1')
    exit()
  prev = mandist % 2

isodd = mandist % 2
ds = [2 ** i for i in range(32)] # 10^9 より大きくなるように適当に
ds = ds[::-1]
if isodd:
  m = 32
else:
  m = 33
  ds += [1]

print(m)
print(' '.join(list(map(str, ds))))
for x, y in ps:
  px = py = 0
  ans = ''
  for d in ds:
    dx = x - px
    dy = y - py
    if abs(dx) >= abs(dy):
      if dx >= 0:
        ans += 'R'
        px += d
      else:
        ans += 'L'
        px -= d
    else:
      if dy >= 0:
        ans += 'U'
        py += d
      else:
        ans += 'D'
        py -= d
  print(ans)

Measured memory_bytes: 3316
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#define FOR(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7;

ll N,M,ans=1;
int main(void)
{
	cin >> N >> M;
	if (N == 1)ans = M;
	else {
	FOR(i, 1, M / N + 1) {
		if (M%i != 0)continue;
		if (M / i >= N)ans = i;
		else break;
	}
}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_right
N,K = map(int,input().split())
V = list(map(int,input().split()))
cmax = -10**9
for x in range(K+1):
    for y in range(K-x+1):
        A = V[:x]
        if y==0:
            A = sorted(A)
            ind = bisect_right(A,0)
            if ind>=K-x-y:
                cnt = sum(A[K-x-y:])
            else:
                cnt = sum(A[ind:])
            cmax = max(cmax,cnt)
        else:
            if y<=N-x:
                A += V[-y:]
                A = sorted(A)
                ind = bisect_right(A,0)
                if ind>=K-x-y:
                    cnt = sum(A[K-x-y:])
                else:
                    cnt = sum(A[ind:])
                cmax = max(cmax,cnt)
            else:
                A = sorted(V[:])
                ind = bisect_right(A,0)
                if ind>=K-N:
                    cnt = sum(A[K-N:])
                else:
                    cnt = sum(A[ind:])
                cmax = max(cmax,cnt)
print(cmax)

Measured memory_bytes: 45784
require 'prime'
n=gets.to_i
h=Hash.new 0
1.upto(n){|i|
	i.prime_division.each{|a,b|
		h[a]+=b
	}
}
r=1
h.each{|a,b|
	r=r*(b+1)%(10**9+7)
}
p r

Measured memory_bytes: 2300
time=[[int(s)for s in input().split()]for i in range(3)]
for t in time:
    t_in=3600*t[0]+60*t[1]+t[2]
    t_out=_in=3600*t[3]+60*t[4]+t[5]
    dur=t_out-t_in
    h=dur//3600
    dur%=3600
    m=dur//60
    dur%=60
    print(" ".join([str(e)for e in [h,m,dur]]))

Measured memory_bytes: 7744
#include <stdio.h>

long int binomal(long int x, long int y){
    long int n = x - y + 1;
    for(int i = x-1; i >= n; --i){
      x = x*i;
    }

    for(int o = y-1; o >= 1; o--){
      y = y*o;
    }

    long int result = 0;

    result = x/y;

    return result;
}
int main(void){
    long int n,m;
    scanf("%ld %ld",&n,&m);
    long int result;

    if(n==1 && m==1){
        result=0;
    }else if(n==1){
        result=binomal(m,2);
    }else if(m==1){
        result=binomal(n,2);
    }else{
        result=binomal(n,2)+binomal(m,2);
    }
    printf("%ld\n",result);
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int main() {
    string w;
    cin >> w;
    vector<int> alpha(26);
    vector<int> num(26);
    alpha.at(0) = 'a';
    rep(i,26) alpha.at(i) = 'a' + i;
    rep(i, w.size()){
        rep(j,26){
            if(w.at(i) == alpha.at(j)) num.at(j)++;
        }
    }
    int ans = 0;
    rep(i, 26){
        if(num.at(i) % 2 == 1){
            cout << "No" << endl;
            break;
        }
        if(i == 25) cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3596
class SegmentTree
  attr_accessor :disp
  def inspect
    @disp
  end
  def initialize(arr, l = 0, r = arr.size - 1)
    @l = l
    @r = r
    if l == r
      @agg = arr[l]
    else
      c = (l + r) / 2
      @left_child = self.class.new(arr, l, c)
      @right_child = self.class.new(arr, c + 1, r)
      @agg = aggregate(@left_child.agg, @right_child.agg)
    end
  end

  attr_reader :agg, :l, :r

  def update(i, &block)
    if @l == @r
      @agg = block.call(@agg)
    elsif i <= @left_child.r
      @left_child.update(i, &block)
      @agg = aggregate(@left_child.agg, @right_child.agg)
    else
      @right_child.update(i, &block)
      @agg = aggregate(@left_child.agg, @right_child.agg)
    end
  end

  def query(l = @l, r = @r)
    return @agg if l == @l && r == @r
    if r <= @left_child.r
      return @left_child.query(l, r)
    elsif @right_child.l <= l
      return @right_child.query(l, r)
    else
      aggl = @left_child.query(l, @left_child.r)
      aggr = @right_child.query(@right_child.l, r)
      return aggregate(aggl, aggr)
    end
  end

  def aggregate(x, y)
    x + y
  end
end

n = gets.to_i
tree = Hash[(0..n-1).map {|i| [i, {}] }]
tree_inv = Hash[(0..n-1).map {|i| [i, nil] }]
out_degree = Hash[(0..n-1).map {|i| [i, 0] }]
n.times do |i|
  k, *neighbours = gets.split.map(&:to_i)
  neighbours.each do |j|
    tree[i][j] = 0
    out_degree[i] += 1
    tree_inv[j] = i
  end
end

subtree_size = Hash[(0..n-1).map {|i| [i, 1] }]
queue = []
out_degree.each do |i, k|
  if k == 0
    queue << i
  end
end
until queue.empty?
  i = queue.shift
  tree[i].each_key do |j|
    subtree_size[i] += subtree_size[j]
  end
  j = tree_inv[i]
  if j
    out_degree[j] -= 1
    queue << j if out_degree[j] == 0
  end
end

queue = [0]
paths = []
position = {}
seg_to_path = {}
until queue.empty?
  i = queue.shift
  path = [i]
  loop do
    heavy = true
    tree[i].each_key.sort_by {|j| -subtree_size[j]}.each do |j|
      if heavy
        path << j
        i = j
        heavy = false
      else
        queue << j
      end
    end
    break if heavy
  end
  path.unshift tree_inv[path[0]] if tree_inv[path[0]]
  weights = path.each_cons(2).map {|i, j| tree[i][j] }
  seg = SegmentTree.new(weights)
  seg_to_path[seg] = path
  (1..path.size - 1).each do |i|
    position[path[i]] = [seg, i - 1]
  end
  seg.disp = path
  paths << path
end

q = gets.to_i
q.times do
  t, i, w = gets.split.map(&:to_i)
  if t == 1
    sum = 0
    loop do
      seg, j = position[i]
      break if !seg
      sum += seg.query(0, j)
      path = seg_to_path[seg]
      i = path[0]
    end
    p sum
  else
    seg, j = position[i]
    seg.update(j) do |x|
      x + w
    end
  end
end



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

int main()
{
string c;
cin >> c;
if (c == "a")
{
cout << "vowel" << endl;
}
else if (c == "i")
{
cout << "vowel" << endl;
}
else if (c == "u")
{
cout << "vowel" << endl;
}
else if (c == "e")
{
cout << "vowel" << endl;
}
else if (c == "o")
{
cout << "vowel" << endl;
}
else
{
cout << "consonant" << endl;
}
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

N, M = map(int, input().split())

X = list(map(int, input().split()))

X.sort()

if N >= M:
    print(0)
    sys.exit()

dist = []

for i in range(len(X)-1):
    dist.append(X[i+1] - X[i])

dist.sort(reverse=True)

ans = X[-1] - X[0]
for i in range(N-1):
    ans -= dist[i]
print(ans)

Measured memory_bytes: 56744
'use strict';
(function(stdin) {
  var inputs = stdin.toString().trim().split('\n');
  var params = inputs[0].split(' ').map(Number);
  params.sort(function(a, b) {return a - b;})
  .join(' ');
    // ????????????????????????
console.log(params[0],params[1],params[2]);

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15500
N,K,Q=map(int,input().split())
c=[K-Q]*N

for i in range(Q):
  A=int(input())-1
  c[A]+=1
    
for k in range(N):
  if c[k]>0:
    c[k]='Yes'
  else:
    c[k]='No'
    
for j in range(N):
  print(c[j])
    
    

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

#define int long long int
#define ff first
#define ss second
#define pb push_back

#define PI 3.14159265358979323846
#define N 100000
#define MOD 1000000007

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	int a[n];

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

	int f = 1;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] % 2 == 0)
		{
			if (a[i] % 3 != 0 && a[i] % 5 != 0)
			{
				f = 0;
				break;
			}

		}
	}

	if (f)
	{
		cout << "APPROVED\n";
	}
	else
		cout << "DENIED\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N;
  cin >> N;
  ll sum = 0;
  ll m = 0;
  rep(i, N) {
    ll l;
    cin >> l;
    sum += l;
    if (l > m) {
      m = l;
    }
  }

  if (sum - m > m) {
    COUT("Yes");
  } else {
    COUT("No");
  }

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	double weight;
	
	while(scanf("%lf", &weight)!=EOF) {
		
		if(weight>91.00) printf("heavy\n");
		else if(weight>81.00) printf("light heavy\n");
		else if(weight>75.00) printf("middle\n");
		else if(weight>69.00) printf("light middle\n");
		else if(weight>64.00) printf("welter\n");
		else if(weight>60.00) printf("light welter\n");
		else if(weight>57.00) printf("light\n");
		else if(weight>54.00) printf("feather\n");
		else if(weight>51.00) printf("bantam\n");
		else if(weight>48.00) printf("fly\n");
		else  printf("light fly\n");
		
		}
	
	return 0;
}


Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int dp[310][310];
int w[310];

int rec(int l,int r){
    if(dp[l][r]!=-1) return dp[l][r];
    if(abs(l-r)<=1) return 0;

    int res=0;
    if(abs(w[l]-w[r-1])<=1 && rec(l+1,r-1)==r-l-2){
        res=r-l;
    }
    for(int mid=l+1;mid<=r-1;mid++){
        res=max(res,rec(l,mid)+rec(mid,r));
    }
    return dp[l][r]=res;
}

int main() {
    while(1){
        int n;
        cin>>n;
        if(n==0) break;
        rep(i,n) cin>>w[i];
        rep(i,310) rep(j,310) dp[i][j]=-1;
        cout<<rec(0,n)<<endl;
    }
    return 0;
}




Measured memory_bytes: 3440
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int n, m, s;
vector<int> et[100000];
vector<int> ec[100000];
int minDist[100000];
int INF = 1145141919;

void dijkstra() {
	for (int i = 0; i < n; i++) minDist[i] = INF;
	typedef pair<int, int> P;
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(P(0, s));
	while (!que.empty()) {
		P now = que.top(); que.pop();
		int cst = now.first;
		int v = now.second;
		
		if (minDist[v] <= cst) continue;
		minDist[v] = cst;
		
		for (int i = 0; i < et[v].size(); i++) {
			que.push(P(cst + ec[v][i], et[v][i]));
		}
	}
}

int main() {
	cin >> n >> m >> s;
	for (int i = 0; i < m; i++) {
		int s, t, d;
		cin >> s >> t >> d;
		et[s].push_back(t);
		ec[s].push_back(d);
	}
	dijkstra();
	for (int i = 0; i < n; i++) {
		if (minDist[i] == INF) cout << "INF" << endl;
		else cout << minDist[i] << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, T;
  cin >> N >> T;
  int res = 1 << 28;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t > T) continue;
    res = min(res, c);
  }
  if (res == (1 << 28)) {
    cout << "TLE" << '\n';
  } else {
    cout << res << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <vector>
template <long long MOD> class Combination_calcurator {
  using ll = long long;

private:
  std::vector<ll> fac;
  std::vector<ll> facinv;
  ll MAX;
  ll modpow(ll a, ll p) {
    if (p == 0)
      return 1;
    if (p % 2 == 0) {
      ll d = modpow(a, p / 2);
      return d * d % MOD;
    } else {
      return a * modpow(a, p - 1) % MOD;
    }
  }
  ll modinv(ll a) {
    // require:m is prime and gcd(a,m) = 1
    return modpow(a, MOD - 2);
  }

public:
  Combination_calcurator(ll max) {
    MAX = max;
    fac.resize(MAX + 1);
    facinv.resize(MAX + 1);
    fac[0] = 1;
    for (int i = 1; i <= MAX; i++) {
      fac[i] = fac[i - 1] * i % MOD;
    }
    facinv[MAX] = modinv(fac[MAX]);
    for (int i = MAX - 1; i >= 0; i--) {
      facinv[i] = facinv[i + 1] * (i + 1) % MOD;
    }
  }

  ll calc(ll n, ll r) {
    return (fac[n] * facinv[r]) % MOD * facinv[n - r] % MOD;
  }
};

#include <iostream>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  ll ans = 0;
  auto com = Combination_calcurator<MOD>(n);
  for (int i = 0; i <= min(n - 1, k); i++) {
    ans += com.calc(n - 1, n - i - 1) * com.calc(n, i);
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3328
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

mod = 10**9+7 #出力の制限
N = 10**5 * 2
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
def p(n,r):
    if ( r<0 or r>n ):
        return 0
    return g1[n] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
# a = cmb(n,r)

import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n,a,b = m()

nn = str(n)[::-1]

co = 1

tw = [[1] for i in range(10)]
for i in range(9):
    tw[0].append(tw[0][-1] * 2)
for i in range(1,10):
    for j in range(9):
        if j == 0:
            tw[i].append((tw[i-1][-1] * tw[i-1][1])%mod)
        else:
            tw[i].append((tw[i][-1]*tw[i][1])%mod)

for i in range(len(nn)):
    if i == 0:
        co *= tw[i][int(nn[i])]
    else:
        co = (co * tw[i][int(nn[i])])%mod
        co = co % mod

aaa = 1
bbb = 1
for i in range(min(a,n-a)):
    aaa *= (n-i)
    aaa %= mod
    if i == min(a,n-a)-1:
        aaa *= g2[i+1]
        aaa %= mod
for i in range(min(b,n-b)):
    bbb *= (n-i)
    bbb %= mod
    if i == min(b,n-b)-1:
        bbb *= g2[i+1]
        bbb %= mod


print((co - aaa - bbb - 1)%mod)



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

typedef long long int ll;

#define endl '\n'

ll n,k;
ll arr[10005];
ll dp[100005];
ll solve(ll u)
{
    if(u<0){
        return 1;
    }
    if(u==0){
        return 0;
    }

    if(dp[u]==-1)
    {
        ll val = 0;
        for(ll i=0;i<n;i++){

            val  = (1-solve(u-arr[i]))|val;
        }
        dp[u] = val;

    }
    //cout<<u<<" "<<dp[u]<<endl;
    return dp[u];

}

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(ll i=0;i<n;i++){
        cin>>arr[i];
    }

    solve(k) ? cout<<"First"<<endl : cout<<"Second"<<endl;


}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    string s; cin>>s;
    int red=0,blue=0;
    REP(i,N){
        if(s[i]=='R') red++;
        if(s[i]=='B') blue++;
    }
    cout<<(red>blue? "Yes":"No")<<endl;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main() {
	
	int n;
	while( cin >> n && n != 0 ) {
		
		int A[2] = {};
		
		for(int i=0;i<n;i++) {
		
		int a, b;
		cin >> a >> b;
		
		if( a > b)
		A[0] += ( a + b );
		
		if( a == b) {
		A[0] += a; 
		A[1] += b;
		
	}
		if( a < b)
		A[1] += ( a + b);
		
}
		cout << A[0] << " " << A[1] << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3076
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		String input = sc.next();
if(input.charAt(0) != 'A'){
System.out.println("WA");
return;
}
int ccount = 0;
int cposition = 0;
for(int i = 2; i < input.length()-1;++i){
if(input.charAt(i) == 'C'){
ccount++;
cposition = i;
}
}
if(ccount != 1){
System.out.println("WA");
return;
}
String trimStr = input.substring(1, cposition) + input.substring(cposition + 1);
if(trimStr.equals(trimStr.toLowerCase()))
System.out.println("AC");
else
System.out.println("WA");

	}
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
import math
import sys

X = int(input())

for A in range(-118, 120):
  for B in range(-119, 119):
    val = math.pow(A, 5) - math.pow(B, 5)
    if(val == X):
      print(A, B)
      sys.exit()   

Measured memory_bytes: 9440
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

vector<vector<int>> memo;
vector<vector<int>> v;

void f(int d, int vv, int c){
	if(d < 0 || memo[d][vv] != 0) return;
	memo[d][vv] = c;
	rep(i, d) f(i, vv, c);
	rep(i, v[vv].size()) f(d-1, v[vv][i], c);
	
	return;
}

int main(void){
	int n, mm; cin >> n >> mm;
	v.resize(n);
	memo.assign(11, vector<int>(n, 0));
	rep(i, mm){
		int ta, tb; scanf("%d%d", &ta, &tb); ta--; tb--;
		v[ta].push_back(tb); v[tb].push_back(ta);
	}
	int qq; cin >> qq;
	vector<int> qv(qq), qd(qq), qc(qq);
	rep(i, qq) scanf("%d%d%d", &qv[i], &qd[i], &qc[i]), qv[i]--;
	irep(i, qq) f(qd[i], qv[i], qc[i]);
	rep(i, n) cout << memo[0][i] << endl;
	
	return 0;
}

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


public class D
{
	public static void Main()
	{
		long N = GetLong();

		List<long> divisor = new List<long>();
		for(long i = 1; i * i < N; i++)
		{
			divisor.Add(i);
			divisor.Add(N/i);
		}
		long sqrtN = (long)(Math.Sqrt(N));
		if(sqrtN * sqrtN == N)
			divisor.Add(sqrtN);

		long ans = 0;
		for(int i = 1; i < divisor.Count; i++)  // skip divisro[0] = 1
		{
			long m = divisor[i] - 1;
			if((N/m) == (N % m))
				ans += m;
		}
		Console.WriteLine(ans);
	}
}


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(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, a[101010];
void solve(){
	cin >> n;
	bool b = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] % 2) b = 1;
	}
	if(b) cout << "first" << endl;
	else cout << "second" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

int main() {
  double a, b, c, d, e, f, x, y;
  while (cin >> a >> b >> c >> d >> e >> f) {
    x = (c * e - b * f) / (a * e - b * d);
    y = (c - a * x) / b;
    cout << fixed << setprecision(3) << x + 0 << " " << y + 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 3192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

static class Program
{
    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

    static int Solve(List<int>[] A)
    {
        int M = A[0].Count;
        int min = int.MaxValue;
        for (int i = 0; i < M; ++i)
        {
            var counts = new Dictionary<int, int>();
            foreach (var a in A)
            {
                if (!counts.ContainsKey(a[0])) { counts[a[0]] = 0; }
                ++counts[a[0]];
            }
            var max = counts.OrderByDescending(pair => pair.Value).First();
            min = Math.Min(max.Value, min);
            for (int j = 0; j < A.Length; ++j) { A[j].Remove(max.Key); }
        }
        return min;
    }

    static void Main(string[] args)
    {
        int[] values = ReadInts();
        List<int>[] A = new List<int>[values[0]];
        for (int i = 0; i < A.Length; ++i) { A[i] = ReadInts().ToList(); }
        Console.WriteLine(Solve(A));
    }
}


Measured memory_bytes: 17884
N,Z,W = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
if(N!=1):
    if(abs(a[-1]-W)>abs(a[-2]-a[-1])):
        print(abs(a[-1]-W))
    else:
        print(abs(a[-2]-a[-1]))
else:
    print(abs(a[-1]-W))


Measured memory_bytes: 3188
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    static int binarysearch(int[] S,int search){
        int len=S.length;
        int left=0;
        int right=S.length-1;
        while(len>1){
            if(search<=S[(right+left)/2]){
                right=(right+left)/2;
                len=right-left+1;
            }
            else{
                left=(right+left)/2+1;
                len=right-left+1;
            }
        }
        return S[right]==search ? 1 : 0;
    }
    public static void main(String[] args){
        int ans=0;
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] S=new int[n];
        for(int i=0;i<n;i++){
            S[i]=sc.nextInt();
        }
        int q=sc.nextInt();
        int[] T=new int[q];
        for(int i=0;i<q;i++){
            T[i]=sc.nextInt();
        }
        Arrays.sort(T);
        for(int i=0;i<q;i++){
            ans+=binarysearch(S,T[i]);
        }
        System.out.println(ans);
    }
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
int a[125252];
int s[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n)scanf("%d",a+i);
  REP(i,n)s[i+1] = (s[i]+a[i]) % m;
  map<int,int> cnt;
  REP(i,n+1)cnt[s[i]]++;
  ll ans = 0;
  for(pii P : cnt){
    ll v = P.second;
    ans += v*(v-1)/2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3968