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

namespace Aizu
{
    class Program
    {
        static void Main(string[] args)
        {
            var firstLine = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
            var n = firstLine[0];
            var w = firstLine[1];
            var goods = new List<int[]>();

            for(var i = 0; i < n; i++)
            {
                goods.Add(Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray());
            }

            var dictionary = new Dictionary<int, int>();
            for(var i = 0; i < n; i++)
            {
                var j = 1;
                var tmpWeight = j * goods[i][1];
                while (tmpWeight <= w)
                {
                    var tmpValue = j * goods[i][0];
                    if(!dictionary.ContainsKey(tmpWeight))
                    {
                        dictionary.Add(tmpWeight, tmpValue);
                    }
                    else
                    {
                        dictionary[tmpWeight] = Math.Max(dictionary[tmpWeight], tmpValue);
                    }

                    j++;
                    tmpWeight = j * goods[i][1];
                }
            }

            goods.Clear();
            foreach(var keyValuePair in dictionary)
            {
                goods.Add(new int[] { keyValuePair.Value, keyValuePair.Key });
            }

            var knapsack = new int[goods.Count + 1, w + 1];

            for (var i = 0; i <= goods.Count; i++)
            {
                for(var j = 0; j <= w; j++)
                {
                    if(i == 0 || j == 0)
                    {
                        knapsack[i, j] = 0;
                    }
                    else
                    {
                        knapsack[i, j] = int.MinValue;
                    }
                }
            }

            for (var i = 1; i <= goods.Count; i++)
            {
                for (var j = 1; j <= w; j++)
                {
                    if (j - goods[i - 1][1] >= 0)
                    {
                        knapsack[i, j] = Math.Max(knapsack[i - 1, j], knapsack[i - 1, j - goods[i - 1][1]] + goods[i - 1][0]);
                    }
                    else
                    {
                        knapsack[i, j] = knapsack[i - 1, j];
                    }
                }
            }

            Console.WriteLine(knapsack[goods.Count, w]);
        }
    }
}



Measured memory_bytes: 411768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n;
  cin>>n;
  string s;
  map<string,int>dic;
  rep(i,n) {cin>>s;
            dic[s]++;}
  int p=0;
  for(auto m:dic) p=max(p,m.second);
  for(auto m:dic){
    if(p==m.second)
      cout<<m.first<<endl;
  }
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++) 
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
//#define x first
//#define y second

using namespace std;
int n;
int main()
{
	cin>>n;
	if(n==1||n==2||n==3||n==5||n==6||n==9||n==10||n==13||n==17) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	
	return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1000000000;
const int MOD = 1000000007;

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if(s == "abc") cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;


int main(){
	ll N; cin >> N;
    vector<string> S(N);
    ll ans = 1;
    REP(i,N) cin >> S[i];
    sort(ALL(S));
    string tmp = S[0];
  	REP2(i,1,N){
        if(tmp != S[i]) ans++;
    	tmp = S[i];  
    }
    cout << ans;
  	return 0;
}

Measured memory_bytes: 9608
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_D

#include <iostream>
using namespace std;
int main(){
  int n, m;
  cin >> n >> m;
  int a[n][m];
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
        cin >> a[i][j];
    }
  }
  //??????????????????
  int vec[m];
  for(int i = 0; i < m; i++){
    cin >> vec[i];
  }

  for(int i=0; i<n; i++){
    int multi = 0;
    for(int j=0; j<m; j++){
      multi += vec[j]*a[i][j];
    }
    cout << multi << endl;
  }

  return 0;
}

Measured memory_bytes: 1200
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		br.close();

		int n = s.length;
		int p = 2019;

		long ans = 0;
		if (10 % p == 0) {
			for (int i = n - 1; i >= 0; i--) {
				long x = s[i] - '0';
				if (x % p == 0) {
					ans += i + 1;
				}
			}

		} else {
			int now = 0;
			int base = 1;
			int[] cnt = new int[p];
			cnt[0] = 1;
			for (int i = n - 1; i >= 0; i--) {
				int x = s[i] - '0';
				x *= base;
				x %= p;
				now += x;
				now %= p;
				ans += cnt[now];
				cnt[now]++;
				base *= 10;
				base %= p;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 36860
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
// --------------------------------------------------</TEMPLATE>--------------------------------------------------


void solve()
{
    ll d,t,s;
    cin>>d>>t>>s;
    double c=(double)d/(t*1.0);
    if(s>=c)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
using namespace std;

#define ll long long
#define MP make_pair

int main(void) {
  int a[3],num[101]={},ans=0;
  for (int i = 0; i < 3; i++) {
    cin>>a[i];
    num[a[i]]++;
  }
  for (int i = 0; i <= 101; i++) {
      if(num[i]>0)ans++;
  }
  cout<<ans<<"\n";




  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

bool check(string s){
  if(s == "Vacant") return true;
  else return false;
}

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

  int n;
  cin >> n;
  cout << 0 << endl;
  vector<string> s(n);
  cin >> s[0];
  if(check(s[0])) return 0;  
  cout << n-1 << endl;
  cin >> s[n-1];
  if(check(s[n-1])) return 0;
  int lb =0;
  int ub = n-1;
  while(ub - lb>1){
    int mid = (ub+lb)/2;
    cout << mid << endl;
    cin >> s[mid];
    if(check(s[mid])) return 0;
    if((mid - lb)%2==0){
      if(s[mid]==s[lb]){
        lb = mid;
      }
      else{
        ub = mid;
      }
    }
    else{
      if(s[mid]!=s[lb]){
        lb = mid;
      }
      else{
        ub = mid;
      }
    }
  }
  cout << ub << endl;
  cin >> s[ub];
  if(check(s[ub])) return 0;
  cout << lb << endl;
  cin >> s[lb];
  return 0;
    

}


Measured memory_bytes: 1620
N=int(input())
W=[]
for i in range(N):
    W.append(input())

if len(set(W))==N:
    for i in range(N-1):
        if W[i + 1][0] != W[i][-1]:
            print("No")
            break
        if i==N-2:
            print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
// in the name of Allah ;
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
	int a, b ;
	cin >> a >> b ;
	if ( a % 2 == 1  && b % 2 == 1 ) 
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <set>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

vector <int> v[100005];

int bio[100005];
vector <int> ver;

vector <pair<int, int> > sol;

bool gotov[100005];
int br[100005];

void dfs(int node) {
	if (bio[node]) return ;
	bio[node] = 1;
	for (int i=0 ; i<v[node].size() ; i++) {
		dfs(v[node][i]);
	}
	ver.pb(node);
}

int main() {
	int n,m;
	scanf("%d%d", &n, &m);
	for (int i=0 ; i<m ; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		v[x].pb(y);
		v[y].pb(x);
	}
	if (m%2) {
		printf("-1\n");
		return 0;
	}
	dfs(1);
	//reverse(ver.begin(), ver.end());
	for (int i=0 ; i<n ; i++) {
		int node = ver[i];
		//cout <<"node = "<<node<<endl;
		vector <int> ok;
		for (int j=0 ; j<v[node].size() ; j++) {
			if (!gotov[v[node][j]]) ok.pb(v[node][j]);
		}
		int pos = 0;
		if (br[node] % 2) {
			if (ok.size() == 0) {
				printf("-1\n");
				return 0;
			}
			sol.pb(mp(node, ok[0]));
			pos++;
		}
		for ( ; pos<(int)ok.size()-1 ; pos+=2) {
			for (int k=0 ; k<2 ; k++) {
				sol.pb(mp(node, ok[pos+k]));
			}
		}
		if (pos<ok.size()) {
			sol.pb(mp(ok.back(), node));
			br[ok.back()]++;
		}
		gotov[node] = 1;
	}
	for (int i=0 ; i<m ; i++) {
		printf("%d %d\n", sol[i].x, sol[i].y);
	}
	return 0;
}

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

public class Main {
  private static int solve(int n, char[] cs) {
    int maxValue = 0;
    int x = 0;
    for (char c : cs) {
      if (c == 'I') {
        x++;
      } else {
        x--;
      }
      maxValue = Math.max(maxValue, x);
    }
    return maxValue;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    char[] cs = reader.nextCharArray();
    out.println(solve(n, cs));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21204
#include<iostream>
using namespace std;
int main(){
    int a[3],s=0;
    for(int i=0; i<3; i++){
        cin >> a[i];
        s+=a[i];
    }
    if(s>=22)
        cout << "bust" << endl;
    else
        cout << "win" << endl;
  	return 0;
}
    
    
    

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


int main() {
	
	int k, x;
	cin >> k >> x;
	for(int i=x-k+1; i<=x+k-1; i++){
		cout << i << ' ';
	}
	cout << endl;
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define MOD 1000000007
#define vi vector<int>
#define deb(n) cout<<"[ "#n<<" = "<<n<<" ]"<<endl;
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long  MAX = 1 << 18;
int case_no=1;
#define w(x) int x; cin>>x; while(x--)

int main() {
	FIO
	int n, k, sum = 0;
	cin >> n >> k;
	vector<int> prices(n);
	for(int i = 0; i < n; i++) cin >> prices[i];
	sort(prices.begin(), prices.end());
	for(int i = 0; i < k; i++) sum += prices[i];
	cout << sum << endl;

	return 0;
}

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



int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,x,y;
	cin>>n>>x>>y;
	map<int,int> map;
	for(int i=1;i<n;i++){
		for(int j=i+1;j<=n;j++)
			{
				int dist=min(j-i,abs(i-x)+1+abs(j-y));
				map[dist]++;
			}
	}
	for(int i=1;i<n;i++)
		cout<<map[i]<<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main()
{
	int i,a,b,c;
	int count = 0;
	
	scanf( "%d%d%d", &a, &b, &c );
	
	for(i=a;i<=b;i++)
	{
		if(c%i==0)
		{
			count++;
		}
	}
	printf( "%d\n", count );
	return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include<string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
using namespace std;
const int MAX=1e5+10;
long long a[MAX];
bool b[MAX];
int main()
{
    long long n,m;
    long long x,y;
    long long num=0;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin>>x>>y;
		if(a[x]>a[y]) b[y]=1;
		if(a[y]>a[x]) b[x]=1;
		if(a[x]==a[y]) b[x]=b[y]=1;
	}
	for(int i=1;i<=n;i++)
	{
		if(!b[i]) num++;
	}
	cout<<num;
}

Measured memory_bytes: 4472
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

int insertionSort(vector<int> &A, int g)
{
    int cnt = 0;
    repi(i, A.size(), g)
    {
        int v = A[i];
        int j = i - g;
        while (j >= 0 && A[j] > v)
        {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
    return cnt;
}
void shellSort(vector<int> &A)
{
    int cnt = 0, it = 1, m = 0;
    while (it <= A.size())
    {
        it *= 3;
        it++;
        m++;
    }
    it--;
    it /= 3;
    cout << m << endl;
    repi(i, m, 0)
    {
        cout << it << ((i + 1) % A.size() ? " " : "");
        cnt += insertionSort(A, it);
        it--;
        it /= 3;
    }
    cout << endl;
    cout << cnt << endl;
}
int main()
{
    int n;
    cin >> n;
    vector<int> A(n);
    repi(i, n, 0)
    {
        cin >> A[i];
    }

    shellSort(A);
    repi(i, n, 0)
    {
        cout << A[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 6708
#include <cstdio>

int Solve(int w){
	int c = 1150;
	if(w > 30){
		c += (w - 30) * 160;
		c += 140 * 10;
		c += 125 * 10;
	}else if(w > 20){
		c += 140 * (w - 20);
		c += 125 * 10;
	}else if(w > 10){
		c += 125 * (w - 10);
	}
	return c;
}

int main(){
	int self;
	//int bf;
	while(1){
	
		scanf("%d",&self);
		if(self == -1){break;}
		printf("%d\n",4280 - Solve(self));
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <ctype.h>
#include <string>
using namespace std;

int main(int argc, char const *argv[]) {
  string s1,s2,s3;
  char c1,c2,c3;
  cin >> s1 >> s2 >> s3;
  c1 = toupper(s1[0]);
  c2 = toupper(s2[0]);
  c3 = toupper(s3[0]);

  cout << c1 << c2 << c3 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String ret = "";
    switch (sc.next()) {
      case "A":
       ret = "T";
        break;
      case "G":
       ret = "C";
        break;
      case "T":
        ret = "A";
        break;
      case "C":
        ret = "G";
        break;
    }
    System.out.println(ret);
  }
}

Measured memory_bytes: 21716
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
struct node{
	int z;
	int y;
}a[100001];
int cmp(node m,node n)
{
	return m.y==n.y?m.z<n.z:m.y<n.y;
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&a[i].z,&a[i].y); //cin>>a[i].z>>a[i].y;
	}
	sort(a+1,a+1+m,cmp);
	int ans=0,time=0;
	for(int i=1;i<=m;i++)
	{
		if(a[i].z<time&&a[i].y>=time) continue;
		else
		{
			ans++;
			time=a[i].y;
		} 
	}
	cout<<ans<<endl; 
	return 0; 
} 

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main()
{
	
	int n, k;
	int d[100], a;
	scanf("%d %d", &n, &k);
	short c[100] = { 0 };
	
	for (int i = 0; i != k; i++) 
	{
		scanf("%d", &d[i]);
		for (int j = 0; j != d[i]; j++) 
		{
			scanf("%d", &a);
			c[a - 1] = 1;
		}
	}
	
	int b = 0;
	for (int i = 0; i != n; i++) 
	{
		if (!c[i]) 
		{
			b++;
		}
	}
	printf("%d", b);

	return 0;
}


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

int main() {
	string eki, resul;
		cin >> eki;
	if (eki[0] == eki[1] && eki[1] == eki[2]) {
		resul = "No";
	}
	else {
		resul = "Yes";
	}
	cout << resul << endl;
	return 0;
}

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

char str[10];
int ans[SIZE];
map <vector <int>,int> mp;
int red(vector <int> vec)
{
	sort(vec.begin(),vec.end());
	if(mp.count(vec)) return mp[vec];
	printf("?");
	for(int i=0;i<vec.size();i++) printf(" %d",vec[i]+1);puts("");
	fflush(stdout);
	scanf("%s",&str);
	return mp[vec]=(str[0]=='R'?1:0);
}
vector <int> get_range(int l,int r)
{
	vector <int> ret;
	for(int i=l;i<=r;i++) ret.push_back(i);
	return ret;
}
vector <int> concate(vector <int> A,vector <int> B)
{
	for(int i=0;i<B.size();i++) A.push_back(B[i]);
	return A;
}
int main()
{
	int n;
	scanf("%d",&n);
	int fr=red(get_range(0,n-1));
	vector <int> vx;
	int l=0,r=n;
	while(l+1<r)
	{
		int d=(l+r)/2;
		int now=red(get_range(d,d+n-1));
		if(now!=fr) r=d;
		else l=d;
	}
	l=r;
	r=r+n-2;
	//printf("%d %d\n",l,r);
	vx=get_range(l,r);
	vector <int> vr,vb;
	for(int i=0;i<2*n;i++)
	{
		if(i<l||r<i)
		{
			vector <int> now=vx;
			now.push_back(i);
			ans[i]=red(now);
			if(ans[i]==1&&vr.size()<n/2) vr.push_back(i);
			else if(ans[i]==0&&vb.size()<n/2) vb.push_back(i);
		}
	}
	vector <int> vl=concate(vr,vb);
	for(int i=l;i<=r;i++)
	{
		vector <int> now=vl;
		now.push_back(i);
		ans[i]=red(now);
	}
	printf("! ");
	for(int i=0;i<2*n;i++) printf("%c",ans[i]==1?'R':'B');
	puts("");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

#define rep1(i,x) for(ll i=1;i<=(x);++i)

ll imos[100002];
ll P[100002];
ll A[100002], B[100002], C[100002];

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

	ll N, M; cin >> N >> M;

	cin >> P[0];
	ll pre = P[0];

	rep1(i, M - 1) {
		cin >> P[i];
		if (pre < P[i]) {
			imos[pre]++; imos[P[i]]--;
		} else {
			imos[P[i]]++; imos[pre]--;
		}

		pre = P[i];
	}

	rep1(i, N - 1) cin >> A[i] >> B[i] >> C[i];

	ll ans = 0;

	rep1(i, N - 1) {
		imos[i] += imos[i - 1];
		ans += min(A[i] * imos[i], C[i] + B[i] * imos[i]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 5096
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	for (long u = 0; u < 12000; u++)
	{
		string a = "",b = "";

		cin >> a >> b;
		if (a == "0" && b == "0")
		{
			break;
		}

		int hit = 0,bro = 0;

		for (int i = 0; i < 4; i++)
		{
			for (int j = 0; j < 4; j++)
			{
				if (a.substr(i,1) == b.substr(j,1) && i == j)
				{
					hit += 1;
				}
				else if (a.substr(i,1) == b.substr(j,1))
				{
					bro += 1;
				}
			}
		}

		cout << hit << " " << bro << endl;
	}
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    string c = "";
    rep(i, s.size())c += '9';
    int ans = 0;
    rep(i, n)rep(j, n){
        rep(k, 10)rep(l, 10){
            string t = c;
            t[i] = '0' + k;
            t[j] = '0' + l;
            if(t <= s){
                int sum = 0;
                rep(m, n){
                    sum += t[m] - '0';
                }
                ans = max(ans, sum);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3576
import           Control.Applicative
import           Control.Monad

main :: IO ()
main = do
    [n, m] <- fmap read . words <$> getLine :: IO [Int]
    as <- replicateM n getLine
    bs <- replicateM m getLine
    let cs = fmap (fmap read . words) as :: [[Int]]
    let ds = fmap read bs :: [Int]
    forM_ cs $ \c -> do
        print $ sum $ zipWith (*) c ds



Measured memory_bytes: 7592
#include<stdio.h>
int main(){
  int n,a,i,j,d[210];
  scanf("%d",&n);
  for(i=0;i<2*n;i++){
    scanf("%d",&a);
    for(j=i;j&&d[j-1]>a;j--)d[j]=d[j-1];
    d[j]=a;
  }
  for(i=a=0;i<n;i++)a+=d[i*2];
  printf("%d\n",a);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



#define index_of(a, x) distance(a.begin(), lower_bound(a.begin(), a.end(), x));
vector<int> longestSubstr(const vector<int>& a) {
	int n = (int)a.size();
	vector<int> A(n, iINF);
	vector<int> id(n);
	
	for (int i=0; i<n; i++) {
		id[i] = index_of(A, a[i]);
		A[ id[i] ] = a[i];
	}
	
	int m = *max_element(id.begin(), id.end());
	vector<int> b(m+1);
	for (int i=n-1; i>=0; i--) if (id[i] == m) b[m--] = a[i];
	return b;
}

#define MAX 10

int main() {
	int n; cin >> n;
	
	for_(i, 0, n) {
		vci a(MAX);
		for_(j, 0, MAX) cin >> a[j];
		vci b = longestSubstr(a);
		vci rest;
		
		for_(j, 0, MAX) if (!binary_search(all(b), a[j])) rest.pb(a[j]);
		
		bool ok = true;
		for_(j, 1, (int)rest.sz) if (rest[j-1]>rest[j]) ok = false;
		
		if (ok) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  int x,n;
  cin >> x >> n;
  if(n==0){
    cout << x << endl;
    return 0;
  }
  vector<int> a(n);
  rep(i,n)
    cin >> a.at(i);
  int l,r;
  l=x;
  r=x;
  rep(i,10000000){
    bool bl=1;
    bool br=1;
    rep(i,n){
      if(a.at(i)==l)bl=0;
      if(a.at(i)==r)br=0;
    }
    if(bl){
      cout << l << endl;
      break;
    }
    if(br){
      cout << r << endl;
      break;
    }
    l--;
    r++;
  }
}
  

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip> 
#define pb push_back
#define mp make_pair
#define fi first 
#define se second
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define per(j, a, b) for (long long j = a; j >= b; j--)
using namespace std;
int main(){
	string s, t;
	cin >> s >> t;
	int ans = s.size();
	rep(i,0,s.size()){
		if(s.size()-i<t.size())break;
		int cur = 0;
		rep(j,0,t.size()){
			if(s[i+j]!=t[j])cur++;
		}
		ans = min(ans, cur);
	}
	cout << ans << endl;
	
}



Measured memory_bytes: 3624
from heapq import heapify,heappush,heappop
N, M = map(int, input().split())

I = [[] for _ in range(N)]
for i in range(M):
  A, B = map(int, input().split())
  A -= 1
  B -= 1
  I[A].append(B)
  I[B].append(A)

task = [] 
used = [0 for _ in range(N)]
min_len = [0 for _ in range(N)]
length = [10**20 for _ in range(N)]
prev_points = [0 for _ in range(N)]
heappush(task, (0, 0, -1))
print("Yes")

while task:
  while task:
    l, p, prev = heappop(task)    
    if used[p] == 0:
      break
  #print(task)
  used[p] = 1
  min_len[p] = l
  prev_points[p] = prev +1 #番号を1ずらす
  
  for j in I[p]:
    if used[j] == 1: continue
    #print(p,j)
    if length[j] > l+1:
      length[j] = l+1
      heappush(task, (l+1, j, p))
    
for i in range(1, N):
  print(prev_points[i])

Measured memory_bytes: 117972
import java.util.*;

public class Main {

	public static long answer = 0;
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int N = in.nextInt();
		long[] arr = new long[87];
		arr[0] = 2;
		arr[1] = 1;
		for (int i = 2; i < arr.length; i++) {
			arr[i] = arr[i - 1] + arr[i - 2];
		}
		System.out.println(arr[N]);
	}
}


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

template<int mod> struct modulo {
	int w;
	operator int&() { return w; }
	operator int() const { return w; }
	
	modulo() {}
	modulo(int w, bool f = 1) { this->w = w; if (f) fix(); }
	void inline fix() { w %= mod; if (w < 0) w += mod; }
	modulo inline fix(int w) { w %= mod; if (w < 0) w += mod; return w; }
	
	inline modulo  operator - () { w = mod - w; return *this; }
	inline modulo& operator += (const modulo &b) { w += b.w; if (w >= mod) w -= mod; return *this; }
	inline modulo& operator -= (const modulo &b) { w -= b.w; if (w < 0) w += mod; return *this; }
	inline modulo& operator *= (const modulo &b) { w = (num) w * b.w % mod; return *this; }
	inline modulo& operator /= (const modulo &b) { return *this *= inv(b); }
	inline modulo  operator +  (const modulo &b) { modulo r = *this; return r += b; }
	inline modulo  operator -  (const modulo &b) { modulo r = *this; return r -= b; }
	inline modulo  operator *  (const modulo &b) { modulo r = *this; return r *= b; }
	inline modulo  operator /  (const modulo &b) { modulo r = *this; return r /= b; }
	
	friend inline modulo pow(const modulo &w, int p) {
		if (!w) return 0;
		modulo a = w, r = 1;
		for (; p > 0; a *= a, p >>= 1) if (p & 1) r *= a;
		return r;
	}
	
	friend inline modulo inv(const modulo &w) { return pow(w, mod - 2); }
};
const int mod = 1000000007;
typedef modulo<mod> rem;

const int nsz = 1e3;
int n, l1, r1, l2, r2;
rem fac[2][nsz + 5], dp[nsz + 5][nsz + 5], ans;

void inline factorial_init(int to = nsz) {
	fac[0][0] = 1;
	cont (i, to) fac[0][i] = fac[0][i - 1] * rem(i);
	fac[1][to] = inv(fac[0][to]);
	for (int i = to - 1; i >= 0; --i) fac[1][i] = fac[1][i + 1] * rem(i + 1);
}

int main() {
	ios::sync_with_stdio(0);
	factorial_init();
	cin >> n >> l1 >> r1 >> l2 >> r2;
	circ (c, 0, n / l1) {
		if (c && (c < l2 || c > r2)) continue;
		dp[l1 * c][l1] = rem(1) * pow(fac[1][l1], c) * fac[1][c];
	}
	loop (i, n - 1) {
		circ (j, l1, r1) {
			int l = j + 1, m = n - i;
			rem val = dp[i][j];
			if (!val) continue;
			circ (c, 0, m / l) {
				if (c && (c < l2 || c > r2)) continue;
				dp[i + c * l][l] += val * pow(fac[1][l], c) * fac[1][c];
			}
		}
	}
	circ (j, l1, r1) {
		ans += dp[n][j];
	}
	ans *= fac[0][n];
	cout << ans << ln;
}

Measured memory_bytes: 4224
#include <iostream>
using namespace std;
static const int mod = 2019;

int main() {
  long long l, r;
  cin >> l >> r;
  long long cnt = 0;
  long long ans = 2018;
  r = min(r, l + mod);
  for (long long i = l; i <= r-1; i++) {
    for (long long j = l+1; j <= r; j++) {
      long long x = (i*j)%mod;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a[5], f[5], max = 0;
    bool flag[5];

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

    int ans = 0;
    for(int i = 0; i < 5; i++)
    {
        f[i] = ((a[i] + 9) / 10) * 10;
        if (max < f[i] - a[i]) {
            max = f[i] - a[i];
        }
    }
    for(int i = 0; i < 5; i++)
    {
        if (max == f[i] - a[i]) {
            flag[i] = true;
            break;
        }
        
    }
    

    for(int i = 0; i < 5; i++)
    {
        if (flag[i]) {
            ans += a[i];
        } else
        {
            ans += f[i];
        }
    }
    
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long answer = 0;
        long[] l = new long[90];
        l[0] = 2;
        l[1] = 1;
        for(int i = 2;i<=n;i++){
            l[i] = l[i-1]+l[i-2];
        }
        System.out.println(l[n]);
    }
}

Measured memory_bytes: 23124
#!/usr/bin/env python3
import os
import sys
from io import BytesIO, IOBase

sys.stdout, stream = IOBase(), BytesIO()
sys.stdout.flush = lambda: os.write(1, stream.getvalue()) and not stream.truncate(0) and stream.seek(0)
sys.stdout.write = lambda s: stream.write(s.encode())

input = BytesIO(os.read(0, os.fstat(0).st_size)).readline


def main():
    a, b, c = map(int, input().split())
    print('Yes' if a == b == c else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38512
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int N;
	cin >> N;
	ll A, B;
	ll m1 = 0, m2 = mod, pmin = mod;
	for (int i = 0; i < N; i++) {
		cin >> A >> B;
		m1 = max(m1, A);
		m2 = min(m2, A);
		pmin = min(pmin, B);
	}
	ll an = pmin;
	//cout << an << endl;
	an += m2 - 1;
	//cout << an << endl;
	an += m1 - m2 + 1;
	cout << an << endl;
}


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

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

ll dp[100005][13];

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

    string S; cin >> S;

    ll mod = 1e9+7;

    reverse(S.begin(),S.end());

    if(S[0] == '?'){
        for (ll i = 0;i <= 9;i++){
            dp[0][i] = 1;
        }
    }else{
        dp[0][S[0]-'0'] = 1;
    }

    ll t = 1;

    for (ll i = 1;i < S.size();i++){
        t = (t*10)%13;
        //cout << (t*9)%13 << endl;
        if(S[i] == '?'){
            for (ll j = 0;j < 10;j++){
                for (ll k = 0;k < 13;k++){
                    dp[i][(k+t*j)%13] += dp[i-1][k];
                    dp[i][(k+t*j)%13] %= mod;
                }
            }
        }else{
            for (ll k = 0;k < 13;k++){
                dp[i][(k+t*(S[i]-'0'))%13] += dp[i-1][k];
                dp[i][(k+t*(S[i]-'0'))%13] %= mod;
            }
        }
    }

    cout << dp[S.size()-1][5]%mod << endl;
  
    return 0;

}

Measured memory_bytes: 10704
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    ll a, b, n;
    cin>>n>>a>>b;
    cout<<n/(a+b)*a + min((n%(a+b)), a);
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3612
#include <stdio.h>

int main(){
    long long int N;
    scanf("%lld",&N);

    char name[50];
    int i=0;
    while(N!=0){
        N--;
        int k=N%26;
        name[i]='a'+k;
        N/=26;
        i++;
    }

    for(int j=i-1;j>=0;j--){
        printf("%c",name[j]);
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 10;
int g[N][N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, m;
	cin>>n>>m;
	memset(g, 0, sizeof(g));
	for(int i = 0; i < m; i++){
		int u, v;
		cin>>u>>v;
		u--; v--;
		g[u][v] = 1;
		g[v][u] = 1;
	}
	vector<int> perm(n);
	for(int i = 0; i < n; i++){
		perm[i] = i;
	}
	int ans = 0;
	while(true){
		bool flg = true;
		for(int i = 1; i < n; i++){
			if(!g[perm[i - 1]][perm[i]])flg = false;
		}
		if(flg)ans++;
		if(!next_permutation(perm.begin() + 1, perm.end()))break;
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int a[4];
int main()
{
  int i;
  char b[3];
  while((scanf("%d,%s",&i,b))!=EOF){
    if(b[0] == 'A' && b[1] == 'B') a[2]++;
    else if(b[0] == 'A') a[0]++;
    else if(b[0] == 'B') a[1]++;
    else a[3]++;
  }
  printf("%d\n%d\n%d\n%d\n",a[0],a[1],a[2],a[3]);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
//#include <boost/range/algorithm/find_if.hpp>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int INF = 999999999;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M);
    int Lmax = 0, Rmin = INF;
    rep(i, M){
        cin >> L[i] >> R[i];
        if(Lmax < L[i]){
            Lmax = L[i];
        }
        if(R[i] < Rmin){
            Rmin = R[i];
        }
    }
    if(Lmax <= Rmin){
        cout << Rmin - Lmax + 1;
    }else{
        cout << 0;
    }
return 0;}
/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 


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

int main(){
	int number;
	int base;
	int digNum= 1;
	
	cin>> number>>base;
	int s= base;
	
	while (base<=number){
		base*=s;
		++digNum;
	}
	cout<< digNum;

	return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	int n,k,out=1001001001;
	cin>>n;cin>>k;
	rep(i,n+1){
		int x=1;
		rep(j,n-i) x*=2;
		x+=i*k;
		out=min(out,x);
	}
	cout<<out<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong(),x = 0;
        long b = a / 15;
        long c = a / 5;
        long d = a / 3;
        for (int i = 1; i <= a; i++) {
            if(i % 3 == 0)continue;
            if(i % 5 == 0)continue;
            x += i;
        }
        System.out.println(x);
    }
}


Measured memory_bytes: 35764
package main

import (
	"fmt"
	"strings"
)

func judgeA(a string) bool {
	if a[0] == 'A' {
		return true
	} else {
		return false
	}
}

func judgeC(a string) bool {
	counter := 0
	for i := 2; i < len(a)-1; i++ {
		if a[i] == 'C' {
			counter++
		}
	}
	if counter == 1 {
		return true
	} else {
		return false
	}
}

func main() {
	var s string
	fmt.Scan(&s)

	if judgeA(s) == false {
		fmt.Println("WA")
		return
	} else {
		if judgeC(s) == false {
			fmt.Println("WA")
			return
		} else {
			if strings.ContainsAny(s, "BDEFGHIJKLMNOPQRSTUVWXYZ") == true {
				fmt.Println("WA")
				return
			} else {
				fmt.Println("AC")
			}
		}
	}
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int main()
{
    string s;
    getline(cin, s);
    ll r = 0;
    for (int i = 0; i < s.size(); i++)
    {
        r += s[i] - '0';
    }

    if (r % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3712
#!/usr/bin/env python3
import sys


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    dp = [[0] * (W+1) for i in range(N+1)]

    for i in range(1,N+1):
        for j in range(1,W+1):
            if j-w[i-1] >= 0:
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1])
            else:
                dp[i][j] = dp[i-1][j]

    print(dp[N][W])

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]" 
    v = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()


Measured memory_bytes: 119024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cmath>
 
#define REP(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
int P[31664];
 
int main(){
    P[0] = P[1] = 1;
    REP(i,180){
        if(P[i]==0){
            for(int j = i*i;j<31664;j+=i) P[j]=1;
        }
    }
    int n,ans;
    cin >> n;ans=n;
    REP(i,31664){
        if(P[i]==0 && n%i==0){
        	while(n%i==0)n/=i;
           ans /= i;
           ans *= (i-1);
        }
        if(n==1)break;
    }
    if(n!=1){
    	ans /= n;
    	ans *= n-1;
    }
    cout << ans << endl;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    int ans=n*(n-1)/2+m*(m-1)/2;
    cout << ans << endl;
}

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

int main() {
	int w, h, n;
	int a, b, c;
	cin>>w>>h>>n;
	
	int x2 = w, y2 = h;
	int x1 = 0, y1 = 0;
	for(int i=0;i<n;++i) {
		cin>>a>>b>>c;
		if(c==1) x1 = max(x1, a);
		else if(c==2) x2 = min(x2, a);
		else if(c==3) y1 = max(y1, b);
		else if(c==4) y2 = min(y2, b);
	}

	int res;
	if(x1>=x2 || y1>=y2) res = 0;
	else res = (x2-x1) * (y2-y1);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
# abc126_a.py
# https://atcoder.jp/contests/abc126/tasks/abc126_a

# A - Changing a Character /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# A, B, C からなる長さ Nの文字列 S と、1 以上 N 以下の整数 K が与えられます。 
# 文字列 S の K 文字目を小文字に書き換え、新しくできた Sを出力してください。

# 制約
#     1≤N≤50
#     1≤K≤N
#     Sは A, B, C からなる長さ Nの文字列

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N K
# S


# 出力
# 文字列 Sの K 文字目を小文字に書き換え、新しくできた Sを出力せよ。

# 入力例 1
# 3 1
# ABC

# 出力例 1
# aBC

# 入力例 2
# 4 3
# CABA

# 出力例 2
# CAbA


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[1]
    # N = int(lines[0])
    N, K = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(6):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(Q):
    #     valueses.append(list(map(int, lines[i+1].split())))

    if S[K-1] == 'A':
        char = 'a'
    elif S[K-1] == 'B':
        char = 'b'
    elif S[K-1] == 'C':
        char = 'c'

    result = S[:K-1] + char + S[K:]

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 1', 'ABC']
        lines_export = ['aBC']
    if pattern == 2:
        lines_input = ['4 3', 'CABA']
        lines_export = ['CAbA']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
ll INF = LLONG_MAX;
 
using vc = vector<char>;
using vi = vector<int>;
using pii = pair<int, int>;

int round_up(int x, int r) {
    return r * (x/r + (x % r != 0)); 
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N; cin >> N;
    vi target (N);
    F0R(i, N) cin >> target[i];

    vi cur (N);
    F0R(i, N) cin >> cur[i];

    priority_queue<pair<int, int>> q;
    F0R(i, N) q.push({cur[i], i});

    ll moves = 0;
    while (!q.empty()) {
        pii front = q.top();
        q.pop();

        int index = front.second;

        int il = (index+1)%N;
        int ir = (index-1+N)%N;

        int onSides = cur[il] + cur[ir];

        if (cur[index] == target[index] ||
            cur[index] < onSides) continue;
    
        int curMoves = (cur[index] - target[index]) / onSides * onSides;

        moves += curMoves / onSides;
        cur[index] -= curMoves;

        q.push({cur[il], il});
        q.push({cur[ir], ir});

    }
    if (cur == target) cout << moves << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 8048