akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<numeric>
#include<limits>
#include <cstdint>
#include<stack>
#include<queue>
using namespace std;
#define ll long long int
#define rep(N) for(ll i=0;i<N;i++)
#define rep2(N1,N2) for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)for(ll k=0;k<N3;k++)
#define For(i,N) for(ll i=0;i<N;i++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for (ll i = 0; i < x; i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k" << endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

ll keta(ll a) {
	ll i = 1;
	while (1) {
		if (a < pow((ll)10, i))
			return i;
		i++;
	}
}
vector<ll> v;
ll n, m;
//m進数全探索
ll inc(ll a = n - 1) {
	if (a == 0 && v[0] == m) {
		v[0] = -1;
		return v[0];
	}
	if (v[a] == m) {
		v[a] = 0;
		inc(a - 1);
		return v[a];
	}
	else {
		++v[a];
		return v[a];
	}
}



int main() {
	ll N, M;
	cin >> N >> M;
	vector<vector<ll>>room(N+1);
	rep(M) {
		ll a, b;
		cin >> a >> b;
		room[a].push_back(b);
		room[b].push_back(a);
	}
	vector<ll>ans(N + 1);
	queue<ll>todo;
	vector<ll>seen(N+1, -1);
	todo.push(1);
	seen[1] = 1;
	while (!todo.empty()) {
		ll a;
		a = todo.front();
		todo.pop();
		for (auto x : room[a]) {
			if (seen[x] == -1) {
				ans[x] = a;
				seen[x] = 1;
				todo.push(x);
			}
		}
	}
	Yn(1);
	rep(N-1)cout << ans[i + 2]<<endl;

}




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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, c, minc=LLONG_MAX, b=0;
  cin >> n;
  vecll a(n);
  forll(i, 0, n){
	cin >> a[i];
	b += a[i] * a[i];
  }
  forll(i, -100, 101){
	c = 0;
	forll(j, 0, n){
	  c += -2 * a[j] * i + i * i;
	}
	minc = min(c, minc);
  }
  cout << minc + b << endl;
}


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

using namespace std;

int main (void) {
    string S, T;
    cin >> S >> T;

    /* 変換対象の値をそれぞれ入れる */
    vector<int> s_char_array(26, -1);
    vector<int> t_char_array(26, -1);

    int s_char, t_char;
    for ( int i=0; i<(int)S.size(); i++ ) {
        s_char = S.at(i) - 'a';
        t_char = T.at(i) - 'a';

        /* もしすでに変換対象が存在したら変換できない */
        if ( s_char_array[s_char] != -1 ||
             t_char_array[t_char] != -1 ) {
            if ( s_char_array[s_char] != t_char &&
                 t_char_array[t_char] != s_char ) {
                cout << "No" << endl;
                return 0;
            }
        }
        s_char_array[s_char] = t_char;
        t_char_array[t_char] = s_char;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s[3];
  cin >> s[0];
  int n = s[0].size();
  s[1] = s[0].substr(0, (n-1)/2);
  s[2] = s[0].substr((n+3)/2-1);
  rep(i, 3) {
    int sz = s[i].size();
    rep(j, sz) {
      if (s[i][j] != s[i][sz-1-j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

typedef long long ll;

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

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	string s;
	cin >> s;
	string ans;
	FOR(i,0,(int)s.size()){
		if(s[i] == 'B' && !ans.empty()){
			ans.pop_back();
		}
		if(s[i] != 'B'){
			ans.pb(s[i]);
		}
	}
	FOR(i,0,(int)ans.size()){
		cout << ans[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#include<limits>
#include<bitset>
#include<ctype.h>
#include<set>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007LL;
const ll INF=1000000000;
const int MAX=100001;
struct edge{int to,cost;};
typedef pair<int,int> P;
ll C[1000][1000];
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll a[301][301];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    ll ans=0;
    bool f[301][301]={false};
    for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i][k]+a[k][j]<a[i][j]){
                cout<<-1<<endl;
                return 0;
            }
            if(i!=k&&j!=k&&a[i][j]==a[i][k]+a[k][j]){
                f[i][j]=true;
            }
        }
    }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++){
            if(!f[i][j]){
                ans+=a[i][j];
            }
        }
    }
    cout<<ans<<endl;
}

                           


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS

    int n;
    cin >> n;

    vector<int> v(n);

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


 int ans = 1000000000;
    for(int i = 1; i <= 100; i++)
    {
     

      int dist = 0;
      for(int j = 0; j < n; j++)
      {
        dist += (v[j]-i)*(v[j]-i);
      }
      if(ans > dist)
      {
        ans = dist;
      }
    }

    cout << ans;





    return 0;
}


Measured memory_bytes: 3576
const S: usize = 600;
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let mut dp = vec![vec![0; 8]; S];
    for i in 0..dp.len() {
        dp[i][0] = 1;
    }
    for from in 0..dp.len() {
        for to in from..dp.len() {
            for i in 0..7 {
                dp[to][i + 1] += dp[from][i];
            }
        }
    }

    let mut k: usize = sc.read();
    let mut last = vec![0; S];
    for s in (0..S).rev() {
        if k >= dp[s][7] {
            last[s] = k / dp[s][7];
            k %= dp[s][7];
        }
    }
    assert_eq!(k, 0);
    for i in 0..S {
        sc.write("FESTIVA");
        for _ in 0..last[i] {
            sc.write("L");
        }
    }
    sc.write("\n");
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .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: 4352
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>
 
#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;
 
#define pb(x) push_back(x)  
#define rep(n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define len(p) (sizeof(p)/sizeof(*p))
#define debug(x) cerr << #x << ": " << x << '\n'; 
#define int long long
 
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
template <class T> void print(T x){ cout << x << '\n'; }
template <class T> void print(T *x, size_t l){ rep(l){cout << *(x+i) << ' ';} cout << '\n'; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) { int len = v.size(); for (int i = 0; i < len; ++i) { s << v[i]; if (i < len - 1) s << " "; } return s; }

signed main(void){
    int costs[4];
    int amount = 8;
    rep(4){
        cin >> costs[i];
    }

    rep(3){
        if(costs[i]*2 < costs[i+1])
            costs[i+1] = costs[i] * 2;
    }

    int need, cost=0;
    cin >> need;
    need *= 4;
    int idx = 3;
    while(need){
        debug(cost);
        debug(need);
        debug(amount);
        cost += need/amount * costs[idx];
        need %= amount;
        amount >>= 1 ;
        idx--;
    }
    cout << cost << endl;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A'; 

int main()
{
    int n; cin >> n;
    int taro = 0, hanako = 0;
    for(int i=0; i<n; i++){
        string taro_s, hanako_s; cin >> taro_s >> hanako_s;
        if(taro_s == hanako_s){
            taro += 1;
            hanako += 1;
        }else if(taro_s > hanako_s){
            taro += 3;
        }else{
            hanako += 3;
        }
    }
    printf("%d %d\n", taro, hanako);
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,x,l,sum;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++){
  cin >> x;
    l = K - x;
    if (x<l)
      sum += x;
    else
      sum += l;
  }
  cout << sum*2 << endl;
  
}


Measured memory_bytes: 256
"use strict"
 const Main = (input) =>{
   let xs = input.trim().split('\n');
   let str =xs[1].split('');
   let ans =[];
   let N = Number(xs[0])
   
   for(let i=0;i<str.length; i++){
     Number(ans.push(str[i].charCodeAt()+N));
   }
   let ans1 =[];
   for(let i=0;i<str.length; i++){
     if(ans[i]>90){
       ans1.push(String.fromCharCode(ans[i]-26));
     }else{
       ans1.push(String.fromCharCode(ans[i]));
     }
   }
    let ans3 = '';
    for(let i=0;i<str.length; i++){
       ans3+=ans1[i];
   }
     console.log(ans3);
 }
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
	int k;
	string s;
	cin >> k >>  s;
	int l;
	l=s.size();
	
	if(l>k){
		for(int i=0;i<k;i++){
			cout << s[i];
		}
		cout << "..." << endl;
	}
	else cout << s << endl;
	
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);i++)
#define FORE(x,arr) for(auto &x:arr)
#define FOR(i,a,n) for(int i=a;i<(int)(n);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;

int main(int argc, char const *argv[]) {
    int n,l;
    cin>>n>>l;
    vector<string> s(n);
    REP(i,n) {cin>>s[i];}
    sort(ALL(s));
    string ans="";
    REP(i,n) {
        ans+=s[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 764
import bisect

n,k=map(int,input().split())
a=list(map(int,input().split()))

amin=min(a)
m=bisect.bisect(a,amin)

for i in range(n):
    if a[i]==1:
        m=i+1
        

k1=k-1
#print(m,k1)

if k1==1:
    print(n-1)
else:
    if m==0:
        n2=(n-1)//k1+1
        print(n2)
    elif m==n:
        n2=(n-1)//k1+1
        print(n2)
    else:
        n2=(m-1-1)//k1+1
        n2r=(n2)*k1-(m-1)
        n3=(n-m-1-n2r)//k1+1
#        print("n",n,"m",m,"k1",k1,"n2",n2,"n3",n3)
        print(n2+n3)

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

void solve(long long P, long long Q, long long R) {
    ll ans = INF;
    ans = min(ans, P + Q);
    ans = min(ans, P + R);
    ans = min(ans, Q + R);
    cout << ans << endl;
}

int main() {
    long long P;
    scanf("%lld", &P);
    long long Q;
    scanf("%lld", &Q);
    long long R;
    scanf("%lld", &R);
    solve(P, Q, R);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{ 
   //freopen("in.txt","r",stdin);
  // freopen("out.txt","w",stdout);
  long long int k,a,b;
    cin>>k>>a>>b;
   long long int ans=0;
 long long int r=1; 
    if(a<b&&b-a>2)
	{    int yen=0; 
	  while(k!=0)
	   {   if(r>=a&&k>=2)
	       { 
		     r+=b-a;  
	       	 k=k-2;
		   }
	     if(r<a)
	      {  r++;
	      	  k--;
		  }
		   else if(k<2)
		     break; 
		   }
	 	
	   } 	
	   if(k>0)
	     r+=k;
		cout<<r; 	   
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

int main() {
  string s;
  cin >> s;
  ll n = s.size();
  mint dp[n + 1][13] = {};
  dp[0][0] = 1;
  rep(i, n) {
    rep(j, 13) {
      if(s[i] == '?') {
        rep(k, 10) {
          int nj = (j * 10 + k) % 13;
          dp[i + 1][nj] += dp[i][j];
        }
      } else {
        int nj = (j * 10 + (s[i] - '0')) % 13;
        dp[i + 1][nj] += dp[i][j];
      }
    }
  }
  cout << dp[n][5] << endl;
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

int R,C;
int K;
int V[3005][3005];

int dp[3005][3005][4];

signed main(){
    cin>>R>>C>>K;
    for(int i=0;i<K;++i){
        int r,c,v;
        cin>>r>>c>>v;
        r--,c--;
        V[r][c]=v;
    }
    dp[0][0][0]=0;
    if(V[0][0]!=0)dp[0][0][1]=V[0][0];
    for(int y=0;y<R;++y){
        for(int x=0;x<C;++x){
            if(y==0&&x==0)continue;
            for(int i=0;i<=3;++i){
                if(y==0){
                    chmax(dp[y][x][i],dp[y][x-1][i]);
                    if(i+1<=3)chmax(dp[y][x][i+1],dp[y][x-1][i]+V[y][x]);
                }
                else if(x==0){
                    chmax(dp[y][x][0],dp[y-1][x][i]);
                    chmax(dp[y][x][1],dp[y-1][x][i]+V[y][x]);
                }
                else {
                    chmax(dp[y][x][0],dp[y-1][x][i]);
                    chmax(dp[y][x][i],dp[y][x-1][i]);
                    chmax(dp[y][x][1],dp[y-1][x][i]+V[y][x]);
                    if(i+1<=3)chmax(dp[y][x][i+1],dp[y][x-1][i]+V[y][x]);
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<=3;++i)chmax(ans,dp[R-1][C-1][i]);
    cout<<ans<<endl;
}

Measured memory_bytes: 355676
//print a Rectangle

#include<stdio.h>

int main()
{
	int i,j,k,a[100][2],count;

	i=0;	

	while(1){

		start:
		scanf("%d %d",&a[i][0],&a[i][1]);
		if ( a[i][0]>300 || a[i][1]>300)
			goto start;


		if(a[i][0]==0 && a[i][1]==0)
			break;

		i++;
	
	}
	
	count=i;
		
	for(i=0;i<count;i++){
		for(j=0;j<a[i][0];j++){
				for(k=0;k<a[i][1];k++){
					printf("#");
				}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}
	

Measured memory_bytes: 572
from itertools import permutations
def inpl(): return [int(i) for i in input().split()]

N, M = inpl()
path = [[False]*N for _ in range(N)]


for _ in range(M):
    a,b = inpl()
    path[a-1][b-1] = path[b-1][a-1] = True

ans = 0
for i in permutations(range(1,N)):
    visited = 0
    for j in i:
        if not path[visited][j]:
            break
        visited = j
    else:
        ans += 1
print(ans)


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

/*int main()
{
    string s;
    cin >> s;
    int ans = -1;
    vector<int> a, z;

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == 'A')
        {
            a.push_back(i);
        }
        if (s[i] == 'Z')
        {
            z.push_back(i);
        }
    }

    ans = z.back() - a.front() + 1;
    cout << ans << endl;
}*/

int main()
{
    string s;
    cin >> s;
    int a = 200000, z;

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == 'A')
        {
            a = min(a, i);
        }
        if (s[i] == 'Z')
        {
            z = i;
        }
    }

    cout << (z - a + 1) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9+5;

int main(){
  int n,sum = 0;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
     cin >> a[i];
    while(a[i]%2 == 0) {
      a[i]/=2;
      sum++;
    }
  }
    cout << sum << endl;
  
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;

const int N = 555;
int n;
char s[N];
bool haveW[N], haveB[N];
int a[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf(" %s ", s);
		for (int j = 0; j < n; j++)
		{
			if (s[j] == '.')
			{
				haveW[j] = 1;
				a[i]++;
			}
			else
			{
				haveB[j] = 1;
			}
		}
	}
	int ans = n + 1;
	for (int i = 0; i < n; i++)
	{
		if (haveB[i])
			ans = min(ans, a[i]);
		else
			ans = min(ans, a[i] + 1);
	}
	if (ans == n + 1)
	{
		printf("-1\n");
		return 0;
	}
	for (int i = 0; i < n; i++)
		if (haveW[i])
			ans++;
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <utility>
#include <map>
using namespace std;
 
int main(){
 int N;
 int num;
 map <int, int> m;
 cin >> N;
 for(int i=0; i<N; ++i){
      cin >> num; 
      m.insert(pair<int, int>(num, i+1));
 }
 for (auto const& entry: m)
    {
        cout << entry.second  << ' ';
    }
  
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
  string s;
  cin >> s;
  vector<int> n(4);
  rep(i,4) n[i] = s[i] - '0';
  rep(i,1<<3) {
    string ans;
    ans += s[0];
    int cnt = 0;
    cnt = n[0];
    rep(j,3) {
      if(i>>j & 1) {
        ans.push_back('+');
        ans.push_back(s[j+1]);
        cnt += n[j+1];
      }else{
        ans.push_back('-');
        ans.push_back(s[j+1]);
        cnt -= n[j+1];
      }
    }
    if(cnt != 7) continue;
    cout << ans << "=7" << endl;
    return 0;
  }
  return 0;
}

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

void enqueue(pair<string,int> p);
pair<string,int> dequeue();

#define len 100005

vector< pair<string,int> > que(len);

int head,tail;

int main(){
    int n,q; cin >> n >> q;
    // init
    head = 0; tail = 0;

    for(int i = 0; i < n; i++){
        string str;
        int t;
        cin >> str >> t;
        enqueue(make_pair(str,t));
    }
    int now_t = 0;
    while(head != tail){
        pair<string,int> now = dequeue();
        int time = min(now.second, q);
        now.second -= time;
        now_t += time;

        if(now.second == 0){
            cout << now.first << " " << now_t << endl;
        }else{
            enqueue(now);
        }
    }
}

void enqueue(pair<string,int> p){
    que[tail] = p;
    tail++;
    if(tail == len) tail = 0;    
}

pair<string,int> dequeue(){
    pair<string,int> de = que[head];
    head ++;
    if(head == len) head = 0;
    return de;
}



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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }

int pcnt(int x) {
  return __builtin_popcount(x);
}

int f(int x) {
  if(x == 0) return 0;
  return f(x % pcnt(x)) + 1;
}

int main(){
  int n;
  string s;
  cin >> n >> s;
  vi x(n);
  rep(i,n) x[i] = s[i] - '0';
  int pc = 0;
  rep(i,n) pc += x[i];    
  vi ans(n);
  rep(b,2) {
    int npc = pc;
    if(b == 0) npc++; else npc--;
    if(npc <= 0) continue;
    int m = 0;
    rep(i,n) {
      m = (m*2) % npc;
      m += x[i];
    }

    int k = 1;
    for(int i = n-1; i >= 0; i--) {
      if(x[i] == b) {
        int m1;
        if(b == 0) m1 = (m+k) % npc;
        else m1 = (m-k+npc) % npc;      
        ans[i] = f(m1) + 1;
      }
      k = (k*2) % npc;
    }
  }
  rep(i,n) cout << ans[i] << endl;
}

Measured memory_bytes: 5192
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>



int b()
{
    int a;
    std::cin >> a;
    
    long long sum = 0;
    for(int i = 1; i <= a; i++)
    {
        if(i % 3 == 0 || i % 5 == 0)
        {
            continue;
        }
        sum += i;
    }
    
    std::cout << sum;
    
    return 0;
}


int main(int argc, const char * argv[])
{
    b();
    return 0;
}

Measured memory_bytes: 3636
// problem: "https://atcoder.jp/contests/abc125/tasks/abc125_b"

#include<iostream>
#include<vector>

using namespace std;

int main()
{
    int n;
    cin>>n;

    int x,y;
    vector<int>V,C;

    int i;
    for(i=0;i!=n;i++)
    {
        cin>>x;
        V.push_back(x);
    }

    for(i=0;i!=n;i++)
    {
        cin>>x;
        C.push_back(x);
    }

    int ans=0;
    for(i=0;i!=n;i++)
    {
        if(V[i] > C[i])
            ans += V[i]-C[i];
    }

    cout<<ans;
    
    return 0;
}


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

int main() {
  int N,M;
  cin >> N >> M;
  int sum = 0;
  vector<int> a(M);
  for (int i=0; i<M;i++){
    cin>> a.at(i);
    sum += a.at(i);
  }

  
  if (sum <= N) {
    cout << N - sum << endl;
  }
  else{
    cout << -1 <<endl;
  }
  // ここにプログラムを追記
}


Measured memory_bytes: 3668
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 0), 1000000001*3)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	s := sc.Text()
	rs := []rune(s)
	w := nextInt()

	rout := make([]rune, ((len(rs)-1)/w)+1)
	for i := 0; i < ((len(rs)-1)/w)+1; i++ {
		rout[i] = rs[i*w]
	}
	fmt.Println(string(rout))
}


Measured memory_bytes: 640
// Problem : B - Count Balls
// Contest : AtCoder Beginner Contest 158
// URL : https://atcoder.jp/contests/abc158/tasks/abc158_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb emplace_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
using namespace std;
using namespace __gnu_pbds;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
//create(tree,node,a,start,end)
//query(tree,node,start,end,l,r)
//update(tree,node,start,end,index,value)
void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,a,b;cin>>n>>a>>b;
int x=n/(a+b);
int y=n%(a+b);
cout<<x*a+min(y,a);
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 384
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    fmt.Scan(&n)
    ans := "No"
    dp := make([]bool, n+1)
    dp[0]=true
    for i:=0; i<=n; i++{
        if i+4<=n && dp[i]{
            dp[i+4]=true
        }
        if i+7<=n && dp[i]{
            dp[i+7]=true
        }
    }
    if dp[n]{
        ans = "Yes"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    string S;
    cin >> S;

    rep(i, S.size()) {
        char converted = char(((int(S[i] - 'A') + N) % 26) + int('A'));

        cout << converted;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

#include <array>

/*
    nCk, nPk, 階乗をmodをとりつつ求めるライブラリ
*/
template <int MAX_N = 100000, long long MOD = 1000000007LL>
class Combination {
    std::array<long long, MAX_N + 1> _fact;
    std::array<long long, MAX_N + 1> _fact_inv;

public:
    // xの逆元
    // https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
    long long inv(long long a) const {
        long long b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            swap(a, b);

            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0)
            u += MOD;
        return u;
    }
    // n!
    long long fact(long long n) const {
        return _fact[n];
    }
    // 1 / n!
    long long fact_inv(long long n) const {
        return _fact_inv[n];
    }
    // nPk
    long long perm(long long n, long long k) const {
        return fact(n) * fact_inv(n - k) % MOD;
    }
    // nCk
    long long comb(long long n, long long k) const {
        return perm(n, k) * fact_inv(k) % MOD;
    }

    Combination() : _fact{}, _fact_inv{} {
        _fact[0] = _fact[1] = 1LL;
        for (int i = 2; i <= MAX_N; ++i) {
            _fact[i] = _fact[i - 1] * i % MOD;
        }
        _fact_inv[MAX_N] = inv(_fact[MAX_N]);
        for (int i = MAX_N - 1; i >= 0; --i) {
            _fact_inv[i] = _fact_inv[i + 1] * (i + 1) % MOD;
        }
    }
};

Combination<200000> cm;

int main() {
    ll n, m, k; cin >> n >> m >> k;
    ll ans = 0;
    constexpr ll mod = inf;
    for (ll d = 1; d <= n - 1; ++d) {
        ans += (n - d) * m % mod * m % mod * d % mod;
        ans %= mod;
    }
    for (ll d = 1; d <= m - 1; ++d) {
        ans += (m - d) * n % mod * n % mod * d % mod;
        ans %= mod;
    }
    ans *= cm.comb(n * m - 2, k - 2);
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<cmath>
int n, k;
int a[1001];
long long sum[1001];
long long sub[599999];
int cnt;
int bs[41];
long long ex[41];
long long ans;
bool chk[599999];
int main() {
	scanf("%d%d",&n,&k);
	int i,j;
	for (i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		sum[i] = sum[i - 1] + a[i];
	}
	for (i = 1; i <= n; i++) {
		for (j = i; j <= n; j++) {
			sub[++cnt] = sum[j] - sum[i - 1];
		}
	}
	ex[0] = 1;
	for (i = 1; i <= 40; i++) ex[i] = ex[i - 1] * 2;
	int prev = 41;
	while (prev>0) {
		for (i = prev - 1; i >= 0; i--) bs[i] = 0;
		for (i = 1; i <= cnt; i++) {
			if (chk[i]) continue;
			long long val = sub[i];
			for (j = 40; j >= 0; j--) {
				if (val - ex[j] >= 0) {
					val -= ex[j];
					bs[j]++;
				}
			}
		}
		for (i = prev-1; i >= 0; i--) {
			if (bs[i] >= k) {
				ans += ex[i];
				prev = i;
				break;
			}
		}
		if (i == -1) break;
		for (i = 1; i <= cnt; i++) {
			long long comp = sub[i] & ex[prev];
			if (!chk[i] && comp == 0) {
				chk[i] = true;
			}
		}
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define ff fflush(stdout)
using namespace std;
ll numDigits (ll a) {
	ll b = 0;
	while (a > 0) {
		a /= 10; b++;
	}
	return b;
}
int main () { 
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	scanf("%lld", &a);
	b = 1e18;
	for (i = 1; i <= sqrt(a); i++) {
		if (a % i) continue;
		c = max(numDigits(i), numDigits(a / i));
		b = min(b, c);
	}
	printf("%lld\n", b);
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    int x,a;
    cin>>x>>a;

  	if(x<a)cout<<0<<"\n";
  	else cout<<10<<"\n";
  
    return 0;

}


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

using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	map<int,string> answerMap;
	map<int,int> waCount;
	int waNum = 0,acNum = 0;
	for(int i = 0; i < m; i++){
		int num;
		string result;
		cin>>num>>result;
		if(answerMap.count(num) == 0){		//まだnum番目の問題に答えていない場合
			answerMap.insert(make_pair(num,result));
			if( result == "AC"){
				acNum++;
			}else{
				waCount.insert(make_pair(num,1));
			}
		}else{		//すでにnum番目の問題に答えている場合
			if( answerMap[num] == "WA"){
				if( result == "AC"){
					answerMap[num] = "AC";
					acNum++;
					waNum += waCount[num];
				}else{
					waCount[num]++;
				}
			}
		}
	}
	cout<<acNum<<" "<<waNum<<endl;
	return 0;
}



Measured memory_bytes: 11136
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#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 ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//WA

int main(void){
	bool can=true;
	int n=0,s=0,w=0,e=0;
	string S;
	cin>>S;
	rep(i,S.size()){
		if(S[i]=='W')w++;
		if(S[i]=='N')n++;
		if(S[i]=='S')s++;
		if(S[i]=='E')e++;
	}
	if(w==0 && e!=0)can=false;
	if(w!=0 && e==0)can=false;
	if(s==0 && n!=0)can=false;
	if(s!=0 && n==0)can=false;
	if(can){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b)
{
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

/* a と b の最小公倍数を求める */
long long LCM(long long a, long long b)
{
    long long g = GCD(a, b);
    return a / g * b;
}

signed main()
{
    int N, M;
    cin >> N >> M;
    int ans = 1;
    int tmp = M;
    while (tmp <= N)
    {
        tmp *= M;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main(void){
    int a[3];
    for(int i=0; i < 3; i++){
        cin >> a[i];
        if(a[i] != a[0]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";

    
    return 0;
}

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

using namespace std;
typedef long long int ll;
#define debug(val) "[ " << #val " : " << (val) << " ]\n"
#define space " "
#define space " "
#define vi vector<int>
#define PI atan(1)*4
#define pb push_back
#define ff first
#define ss second
#define PI atan(1)*4

const int maxN = 1000 + 3 ;
char a[maxN][maxN] ;
int dp[maxN][maxN] ;
const int INF =  (int)2e9 ;
const int Mod = (int)1e9 + 7;

void solve() {
    int n , m ;
    cin >> n >> m ;
    for(int i=0;i<n;i++){
        string s ;cin >> s ;
        for(int j=0;j<m;j++){
            a[i][j] = s[j] ;
        }
    }
    dp[0][0] = 1 ;
    for(int i=0;i<n;i++) {
        for(int j=0;j<m;j++){
            if(i == 0 && j == 0 ) continue;
            if(a[i][j] == '#'){
                dp[i][j] = -1 ;
                continue;
            }
            dp[i][j] = 0 ;
            if(i > 0 && a[i-1][j] == '.'){
                dp[i][j] += dp[i-1][j] ;
                dp[i][j] %= Mod ;
            }
            if(j > 0 && a[i][j-1] == '.'){
                dp[i][j] += dp[i][j-1] ;
                dp[i][j] %= Mod ;
            }
        }
    }
//    for(int i=0;i<n;i++){
//        for(int j=0;j<m;j++){
//            cerr << dp[i][j] << space ;
//        }
//        cerr << endl;
//    }
    cout << dp[n-1][m-1] << endl;


}
int main() {
#ifdef _DEBUG // place in cmake-build-debug folder
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        // cout << "Case #" << i << ": ";
        solve();
    }
}


Measured memory_bytes: 8572
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

int main(){
    ll N,M;
    cin>>N>>M;
    v H(N);
    rep(i,0,N)cin>>H[i];
    vv edges(N);
    rep(i,0,M){
        ll a,b;
        cin>>a>>b;
        a--;b--;
        edges[a].PB(b);
        edges[b].PB(a);
    }
    ll ans = 0;
    rep(i,0,N){
        ll now = H[i];
        bool ok=true;
        for(ll nxt: edges[i]){
            if(H[nxt] >= now)ok = false;
        }
        if(ok){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

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

const long long MAX = 1e18;

int main() {
    int N;
    cin >> N;
    long long *A = new long long[N];
    
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    
        if (A[i] == 0) {
            cout << 0;
            return 0;
        }
    }
    
    long long sum = 1;
    long long sum_old = 1;
    for (int i = 0; i < N; i++) {
        /*
        sum_old = sum;
        sum *= A[i];

        if (sum > MAX || sum / A[i] != sum_old) {
            cout << -1;
            return 0;
        }
        */

        
        if (MAX / sum < A[i]) {
            cout << -1;
            return 0;
        } else {
            sum *= A[i];
        }
        
    }
    
    cout << sum;
    return 0;
}

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

using namespace std;
const int IINF = INT_MAX;
using ll = long long;
using P = pair<int,int>;
#define INF 100000000
int n;

int main(){
    int n;
	cin >> n;
	
	for(int i = 1; i < 10; i++){
		for(int j = 1; j < 10; j++){
			if(n == i*j){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" <<endl;
	
    
    return 0;	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;

char str[200005];

void solve()
{
    int n;
    scanf("%d", &n);
    scanf("%s", str);
    vector<int> a(n+1);
    int p,q;
    int good=0;
    for(p=0; p<2; p++) {
        for(q=0; q<2; q++) {
            a[n-1]=p; a[0]=q;
            int i;
            for(i=0; i<n; i++) {
                int tmp=(str[i]=='o'? 0: 1);
                a[(i+1)%n]=(a[(i-1+n)%n]+tmp+a[i])%2;
            }
            if(a[n-1]==p && a[0]==q) {
                good=1;
                break;
            }
        }
        if(good) break;
    }
    if(good) {
        int i;
        for(i=0; i<n; i++) {
            if(a[i]==0) printf("S");
            else printf("W");
        }
        printf("\n");
    }
    else {
        printf("-1\n");
    }

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 768
package main

import "fmt"

func main() {
	var x, d, k int64
	fmt.Scan(&x)
	fmt.Scan(&k)
	fmt.Scan(&d)
	if x < 0 {
		x = -x
	}
	b := x/d
	if k <= b {
		fmt.Println(x - d * k)
		return
	}
	m := k - b
	if m % 2 == 0 {
		fmt.Println(x - d * b)
		return
	}
	fmt.Println((b+1) * d - x)
}

Measured memory_bytes: 1772
#include<iostream>
using namespace std;
int ans;
int main(){
	char c1,c2;
	int a,b,c=0,sum=0,f=0;
	cin>>a>>b;
	cin>>c2;
	for(int i=0;i<a-1;i++){
		c1=c2;
		cin>>c2;
		if(c1==c2)
			sum++;
		else
			f++;
	}
	if(f>2*b)
		cout<<sum+2*b;
	else
		cout<<sum+f;
  return 0;
} 

Measured memory_bytes: 256