akhauriyash/Code-Regression huggingface dataset:
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr <<"debug "<< i << std::endl;

//const ll MOD = 998244353;
const ll MOD = 1e9+7;
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  std::vector<std::vector<ll>> graph(n);
  std::vector<ll> num(n,-1);

  rep(i,0,n-1){
    ll a,b;
    std::cin>>a>>b;

    a--;b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  ll k;
  std::cin>>k;

  ll root;

  rep(i,0,k){
    ll v,p;
    std::cin>>v>>p;
    v--;
    num[v]=p;
    root=v;
  }

  struct Point{ll from,now,odd;};

  std::vector<ll> sort;

  std::queue<Point> que;
  que.push(Point{-1,root,(num[root]+1)%2});

  while(que.size()){
    Point e=que.front();que.pop();
    sort.push_back(e.now);
    if((num[e.now]!=-1)&&(num[e.now]%2==e.odd)){
      std::cout<<"No";
      return 0;
    }

    for(ll i:graph[e.now]){
      if(i!=e.from){
        que.push(Point{e.now,i,(e.odd+1)%2});
      }
    }
  }

  std::vector<P> len(n,{-MOD,MOD});

  std::vector<bool> used(n,false);

  for(ll i=n-1;i>=0;i--){
    ll now=sort[i];
    used[now]=true;
    if((len[now].first>len[now].second)||((num[now]!=-1)&&((len[now].first>num[now])||(num[now]>len[now].second)))){
      std::cout<<"No";
      return 0;
    }
    if(num[now]!=-1)len[now]={num[now],num[now]};

    for(ll next:graph[now]){
      if(!used[next]){
        len[next]={std::max(len[next].first,len[now].first-1),std::min(len[next].second,len[now].second+1)};
      }
    }
  }

  que.push({-1,root,num[root]-1});

  while(que.size()){
    Point e=que.front();que.pop();
    if(e.odd+1<=len[e.now].second)num[e.now]=e.odd+1;
    else num[e.now]=e.odd-1;

    for(ll i:graph[e.now]){
      if(i!=e.from){
        que.push({e.now,i,num[e.now]});
      }
    }
  }

  std::cout<<"Yes\n";

  rep(i,0,n)std::cout<<num[i]<<"\n";

  return 0;
}


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

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

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

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

    ll st = 1;
    for (int i = 1;i < N;i++){
        st *= 10;
    }

    ll to = st*10;

    if(N == 1) st = 0;

    ll s[10];
    char c[10];

    for (int i = 0;i < M;i++){
        cin >> s[i] >> c[i];
    }

    for (int i = st;i < to;i++){
        //cout << i << endl;
        string now = to_string(i);
        bool f = true;
        for (int j = 0;j < M;j++){
            if(now[s[j]-1] != c[j]) f = false;
        }
        if(!f) continue;
        cout << i << endl;
        return 0;
    }

    cout << -1 << endl;

    return 0;

}

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

int main(){
  int N,T,A; cin >>N>>T>>A;
  int close_diff;
  int close_n = 1;
  for(int i=0;i<N;i++){
    int h; cin >> h;
    int temp = T*1000 - h * 6;
    double diff = abs(A*1000-temp);
    if(i==0){
      close_diff = diff;
      continue;
    }
    if(diff<close_diff){
      close_n = i+1;
      close_diff = diff;
    }
  }
  cout << close_n << endl;
}

Measured memory_bytes: 256
N = int(input())
t = a = 1
for _ in range(N):
    T, A = list(map(int, input().split()))
    # t->cT,  a->cA                                                                                                                                                                                                                  
    # min(c) s.t. cT>=t && cA>=a                                                                                                                                                                                                     
    c = max((t+T-1)//T, (a+A-1)//A)
    t, a = c*T, c*A
print(t+a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <map>
//#include <set>
//#include <list>
//#include <cmath>
//#include <ctime>
//#include <deque>
//#include <queue>
//#include <stack>
//#include <string>
//#include <bitset>
//#include <cstdio>
//#include <limits>
//#include <vector>
//#include <climits>
//#include <cstring>
//#include <cstdlib>
//#include <fstream>
//#include <numeric>
//#include <sstream>
//#include <iomanip>
//#include <iostream>
//#include <algorithm>
//#include <unordered_map>

using namespace std;

#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.141592653589793238462643383279502884
#define MAX 1000100
#define mod 1000000007
#define EPS 1E-9
#define int long long
#define endl "\n"

int fix(int cur, int m)
{
    return ((cur%m) + m) % m;
}

int fast_power(int x, int y,int m)
{
    if (y == 0)
        return 1;
    int temp = fast_power(x, y / 2, m) ;
    temp = (temp*temp)% m;
    if (y % 2 != 0)
        temp = (temp*x)% m;
    return temp;

}


int32_t main()
{
    //freopen("C:/Users/Joe/Desktop/tests/in11.txt", "r", stdin);
    //freopen("C:/Users/Joe/Desktop/tests/out11.txt", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.tie(0);

    int t=1;
    //cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cout << ((n)*(n+1))/2 << endl;

    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string T[255];
	T[' '] = "101";
	T['\''] = "000000";
	T[','] = "000011";
	T['-'] = "10010001";
	T['.'] = "010001";
	T['?'] = "000001";
	T['A'] = "100101";
	T['B'] = "10011010";
	T['C'] = "0101";
	T['D'] = "0001";
	T['E'] = "110";
	T['F'] = "01001";
	T['G'] = "10011011";
	T['H'] = "010000";
	T['I'] = "0111";
	T['J'] = "10011000";
	T['K'] = "0110";
	T['L'] = "00100";
	T['M'] = "10011001";
	T['N'] = "10011110";
	T['O'] = "00101";
	T['P'] = "111";
	T['Q'] = "10011111";
	T['R'] = "1000";
	T['S'] = "00110";
	T['T'] = "00111";
	T['U'] = "10011100";
	T['V'] = "10011101";
	T['W'] = "000010";
	T['X'] = "10010010";
	T['Y'] = "10010011";
	T['Z'] = "10010000";

	string in;
	while (getline(cin, in)){
		string trans = "";
		for (int i = 0; i < in.size(); i++){
			trans += T[in[i]];
		}
		int add = (trans.size() + 4) / 5 * 5 - trans.size();
		for (int i = 0; i < add; i++) trans += '0';
		
		int val = 0;
		for (int i = 0; i < trans.size(); i++){
			val <<= 1;
			val += trans[i] == '1';
			if ((i + 1) % 5 == 0){
				printf("%c", "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[val]);
				val = 0;
			}
		}
		puts("");
	}
	return (0);
}

Measured memory_bytes: 1188
#include <iostream>
using namespace std;
int main(void)
{
    double x[4];
    double y[4];
    int n;
    cin >> n;
    while(n--){
        for(int i=0; i<4; i++){
            cin >> x[i] >> y[i];
        }
        double d1,d2;
        d1 = (y[1]-y[0])/(x[1]-x[0]);
        d2 = (y[3]-y[2])/(x[3]-x[2]);
        if(d1==d2) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

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

		   int a = sc.nextInt();
		   int b = sc.nextInt();
		   int c = sc.nextInt();
		   if(a-b>=c) {
			   System.out.println(0);
		   }else {
			   System.out.println(c-a+b);
		   }

		    sc.close();
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>


long long  INF=1000000000000000000;
using namespace std;


int main(){

string s;
cin>>s;
char c;
c=s[0];
int ans=0;
for(int i=0;i<s.size();i++){
ans++;
if(c==s[i+1]){
    i+=2;
    if(i>=s.size()){
        break;
    }
    ans++;
    
    c=s[i+1];
}
c=s[i+1];
}
cout<<ans<<endl;

 return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <math.h>
#include <map>
#include <set>
#include <string>
using namespace std;
#define fio ios::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;

const int INT_INF = 1e9;
const ll LL_INF = 1e18;
const int MAXN = 500003;

typedef struct GE{
    int to;
    ll w;
    GE(){};
}GE;

char s[5];
int main() {

    scanf("%s", s);
    bool f = true;
    for(int i=0;i<3;i++){
        if(s[i]==s[i+1]) f = false;
    }

    if(f)
        puts("Good");
    else
        puts("Bad");
    return 0;
}

Measured memory_bytes: 256
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数 __builtin_popcount bitの個数

int main() {
  st S, T;
  ci(S, T);
  rep(i, sz(S)){
    bool f = 1;
    rep(j, sz(S)){
      if(S.at((i + j) % sz(S)) != T.at(j)){
        f = 0;
      }
    }
    if(f == 1){
      co("Yes");
      rt;
    }
  }
  co("No");
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int H,W;
        while(true){
            H = input.nextInt();
            W = input.nextInt();
            if (H == 0 && W == 0){
                break;
            }
            for (int i = 0; i < H; i++){
                String tmp = (i%2 == 0) ? "#" : ".";
                for (int j = 0; j < W; j++){
                    System.out.printf("%s",tmp);
                    tmp = tmp.equals(".") ? "#" : ".";
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
    }
}


Measured memory_bytes: 104180
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int l=sc.nextInt();
        int o=sc.nextInt();
        String s=sc.next();
        String tmp=String.valueOf(s.charAt(o-1));
        tmp=tmp.toLowerCase();
        String s2=s.substring(0,o-1)+tmp+s.substring(o);
        System.out.println(s2);
    }
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

sum_A = sum(A)
ans = 0
for a in A[:-1]:
  sum_A -= a
  ans += a * sum_A

ans %= mod
print(ans)

Measured memory_bytes: 105292
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++) {
        cin >> A.at(i);
    }
    bool flag = 1;
    int count = 0;
    for (int i = 0; flag; i++) {
        flag = 0;
        for (int j = n-1; j >= i+1; j--) {
            if(A.at(j) < A.at(j-1)) {
                swap(A.at(j), A.at(j-1));
                flag = 1;
                count++;
            }
        }
    }
    for(int i = 0; i < n; i++) {
        cout << A.at(i);
        if(i == n-1) cout << endl;
        else cout << " ";
    }
    cout << count << endl;
}


Measured memory_bytes: 3120
#include<stdio.h>
#include<stdlib.h>


int main(){
  int i,j,k,r,c,sum;
  int **hyou;
  scanf("%d%d",&r,&c);
  hyou=malloc(r*sizeof(int *));
  for(i=0;i<r;i++){
    hyou[i]=malloc(c*sizeof(int));}
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&hyou[i][j]);}
    }
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      printf("%d ",hyou[i][j]);}
    sum=0;
    for(k=0;k<c;k++){
      sum=sum+hyou[i][k];}
    printf("%d\n",sum);}
  for(i=0;i<c;i++){
    sum=0;
    for(j=0;j<r;j++){
      sum=sum+hyou[j][i];}
    printf("%d ",sum);}
  sum=0;
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      sum=sum+hyou[i][j];}}
  printf("%d\n",sum);
  for(i=0;i<r;i++){
    free(hyou[i]);}
  free(hyou);
  return 0;}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	ll H,W;
	ll h,w;
	cin >> H >> W >> h >> w;
	cout << (H-h) * (W-w) << endl;
}

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

int arr[100005],ans[100005];

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

        int n; scanf("%d",&n);
        for(int i=1;i<=n;i++)
            scanf("%d",&arr[i]);
        for(int i=2;i<=n;i++){
            if(i==2)
                ans[i]=abs(arr[i]-arr[i-1]);
            else{
                ans[i]=min((ans[i-1]+abs(arr[i]-arr[i-1])),(ans[i-2]+abs(arr[i]-arr[i-2])));
            }
        }
        printf("%d",ans[n]);

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;
const int N=2e5+10;
char s[N];
int n;
int lst[N];
ll sum;
int main(){
	//freopen("a.in","r",stdin);
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1;i<=n;i++){
		if(s[i]=='A') s[i-1]=='A'?lst[i]=lst[i-1]:lst[i]=i;
		if(s[i-2]=='A'&&s[i-1]=='B'&&s[i]=='C'){
			sum+=(i-2)-lst[i-2]+1;
			s[i]='A';lst[i]=lst[i-2]+2;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#define fo(i,a,b) for(LL i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define max(q,w) ((q)>(w)?(q):(w))
using namespace std;
typedef long long LL;
const int N=1000500,mo=998244353;
int m,n;
LL ans;
LL jc[N],jcn[N];
LL ksm(LL q,int w)
{
	LL ans=1;
	for(;w;w>>=1,q=q*q%mo)if(w&1)ans=ans*q%mo;
	return ans;
}
LL C(int m,int n){return jc[m]*jcn[n]%mo*jcn[m-n]%mo;}
int main()
{
	int q,w;
	scanf("%d%d",&n,&m);
	jc[0]=1;fo(i,1,n+m)jc[i]=jc[i-1]*(LL)i%mo;
	jcn[n+m]=ksm(jc[n+m],mo-2);fod(i,m+n-1,0)jcn[i]=jcn[i+1]*(i+1LL)%mo;
	if(n<m)swap(n,m);
	fo(i,1,m)ans=(ans+C(i*2,i)*C(n+m-i*2,m-i)%mo)%mo;
	printf("%lld\n",(ans*ksm(2,mo-2)%mo*ksm(C(m+n,m),mo-2)+n)%mo);
	return 0;
}

Measured memory_bytes: 15744
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    ll x,y;
    cin >> x >> y;
    ll ans = 0;
    while(x <= y){
        x *= 2;
        ans++;
    }    
    cout << ans << endl;
}

Measured memory_bytes: 256
#127
n, m = list(map(int, input().split(' ')))
a = []
b = []
for i in range(m):
    x = []
    x = list(map(int, input().split(' ')))
    a.append(x[0])
    b.append(x[1])
result = min(b)-max(a)+1
if result <= 0:
    print(0)
else:
    print(int(result))

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,K; cin>>N>>K;
    vector<ll> h(N);
    rep(i,N)cin>>h[i];
    vector<ll> dp(N,INF);
    dp.at(0) = 0;
    rep(i,N){
        for(int j = 1; j <= K; j++){
            if(i+j>=N)break;
            dp.at(i+j) = min(dp.at(i+j),dp.at(i)+(ll)fabs(h.at(i+j)-h.at(i)));
        }
    }
    cout<<dp.at(N-1)<<endl;
}

Measured memory_bytes: 4800
#include <iostream>
using namespace std;
int main()
{
	int a,b;
	float c;
	cin>>a>>b;
	c=(a+b)/2.0;
	if(c-int(c)>=0.5)
				c=c+1;
	printf("%d",int(c));
	

	
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a+b)>=c){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

int main(){
	char s[100001];	
	int i,length;
	
	scanf("%s",s);
	length = strlen(s);
	int winner;//先手:0,後手:1
	
	if(s[0]==s[length-1] && length%2==1){
		winner = 1;
	}else if(s[0]!=s[length-1] && length%2==0){
		winner = 1;
	}else{
		winner = 0;
	}
	
	if(winner){
		puts("Second");
	}else{
		puts("First");
	}
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace jsc2019_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var MD = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var M = MD[0];
            var D = MD[1];

            var ans = 0;
            for (int i = 1; i <= M; i++)
            {
                var f = Factorial(i);
                foreach (var item in f)
                {
                    var v = 10 * item.Item1 + item.Item2;
                    if (item.Item1 >= 10 || item.Item2 >= 10) continue;
                    if (v <= D && v < 100)
                    {
                        ans++;
                    }
                }
            }

            Console.WriteLine(ans);
        }

        public static List<Tuple<int, int>> Factorial(int i)
        {
            var ret = new List<Tuple<int, int>>();
            for (int n = 2; n < i; n++)
            {
                if (i % n == 0 && i / 2 >= 2)
                {
                    ret.Add(new Tuple<int, int>(n, i / n));
                }
            }

            return ret;
        }
    }
}


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

using namespace std;

#define pb push_back
#define nl '\n'
#define pi 2.0*acos(0.0)
#define mod 1e9+7
#define FOR(i,j,n)    for(ll i=j;i<n;i++)
#define RFOR(i,j,n)    for(ll i=j;i>=n;i--)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

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

int main(){
    string s;
    cin>>s;
    FOR(i,0,s.size()){
        if(s[i] == '7'){
            cout<<"Yes"<<nl;
            return 0;
        }
    }
    cout<<"No"<<nl;
}


Measured memory_bytes: 3588
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    x, y = map(int, readline().split())

    S = S.split('T')
    x0 = len(S[0])
    X = [len(s) for s in S[2::2]]
    Y = [len(s) for s in S[1::2]]

    def solve(vec, p0, p):
        s = {p0}
        for v in vec:
            s, s_prev = set(), s
            for w in s_prev:
                s.add(w + v)
                s.add(w - v)
        return p in s

    if solve(X, x0, x) and solve(Y, 0, y):
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 81176
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0; i<h; ++i)
        cin >> s[i];

    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(s[y][x] == '#'){
                cout << '#';
                continue;
            }

            int cnt = 0;
            for(int i=0; i<9; ++i){
                int y2 = y - 1 + i / 3;
                int x2 = x - 1 + i % 3;
                if(0 <= y2 && y2 < h && 0 <= x2 && x2 < w){
                    if(s[y2][x2] == '#')
                        ++ cnt;
                }
            }
            cout << cnt;
        }
        cout << endl;
    }

    return 0;
}


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

using ll = long long;
using namespace std;

const ll mod = 1e9 + 7;
const ll MAX = 1e6;

ll fac[MAX];

void init(){
    fac[0] = 1;
    for (int i = 1; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % mod;
    }
}

ll rep_pow(int n, int p) { // n^p
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        ll t = rep_pow(n, p / 2);
        return t * t % mod;
    } else {
        return n * rep_pow(n, p - 1) % mod;
    }
}

ll com(int n, int k) {
    if (n < k || n < 0 || k < 0) {
        return 0;
    }
    return fac[n] * rep_pow(fac[k], mod - 2) % mod * rep_pow(fac[n - k], mod - 2) % mod;
}

int main() {
    int x, y;
    cin >> x >> y;
    init();
    if ((x + y) % 3) {
        cout << 0 << endl;
        return 0;
    }
    int sm = (x + y) / 3;
    int a = y - sm;
    int b = x - sm;
    cout << com(a + b, b) << endl;
    return 0;
}


Measured memory_bytes: 8064
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    var primeFactors = hashMapOf<Int, Long>()

    // O(N^1.5)
    (1..N).forEach {
        var n = it
        (2..(Math.sqrt(it.toDouble()).toInt())).forEach {
            while (n % it == 0) {
                if (primeFactors.contains(it)) {
                    primeFactors[it] = primeFactors[it]!! + 1
                } else {
                    primeFactors[it] = 1
                }
                n /= it
            }
        }

        if (n != 1) {
            if (primeFactors.contains(n)) {
                primeFactors[n] = primeFactors[n]!! + 1
            } else {
                primeFactors[n] = 1
            }
        }
    }

    var factorsOver75Size = 0L
    var factorsOver25Size = 0L
    var factorsOver15Size = 0L
    var factorsOver5Size = 0L
    var factorsOver3Size = 0L

    primeFactors.entries.forEach {
        val size = it.value
        if (size >= 75 - 1) {
            factorsOver75Size++
        }
        if (size >= 25 -1) {
            factorsOver25Size++
        }
        if (size >= 15 -1) {
            factorsOver15Size++
        }
        if (size >= 5 -1) {
            factorsOver5Size++
        }
        if (size >= 3 -1) {
            factorsOver3Size++
        }
    }

    val answer = factorsOver75Size + factorsOver25Size * (factorsOver3Size - 1) + factorsOver15Size * (factorsOver5Size -1)+     (factorsOver5Size * (factorsOver5Size -1) / 2) * (factorsOver3Size-2)
    println(answer)
}

Measured memory_bytes: 33624
#include <iostream>
#include <vector>
#include <functional>

using namespace std;

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

    vector<vector<int>> ans(N, vector<int>(N, -1));

    // 頂点集合[l, r)からなるクリークにd以上を割り当てる
    function<void(int, int, int)> dfs =
        [&](int l, int r, int d) {
            if (r - l <= 1) return;

            int m = (l + r) / 2;
            // [l, m)と[m, r)に分割して完全に部グラフを構築
            for (int i = l; i < m; ++i) {
                for (int j = m; j < r; ++j) {
                    ans[i][j] = d;
                }
            }

            dfs(l, m, d + 1);
            dfs(m, r, d + 1);
        };
    dfs(0, N, 1);

    for (int v = 0; v < N; ++v) {
        for (int u = v + 1; u < N; ++u) {
            cout << ans[v][u] << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
 
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  int A[N+1][3] = {};
  for(int i=1;i<=N;i++){
    for(int j=0;j<3;j++){
      cin >> A[i][j];
    }
  }
  bool ans = true;
  for(int i=1;i<=N;i++){
    int mod1 = abs(A[i][0] - A[i-1][0]) % 2;
    int mod2 = (abs(A[i][1] - A[i-1][1]) + abs(A[i][2] - A[i-1][2])) % 2;
    if(mod1 != mod2){
      ans = false;
    }
    int time = abs(A[i][0] - A[i-1][0]);
    int len = (abs(A[i][1] - A[i-1][1]) + abs(A[i][2] - A[i-1][2]));
    if(time < len){
      ans = false;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 1408
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
sorted_A = sorted(A)
max_A = sorted_A[N-1]
if(sorted_A[N-2] == max_A):
    for i in range(N):
        print(max_A)
else:
    for i in range(N):
        if(A[i] == max_A):
            print(sorted_A[N-2])
        else:
            print(max_A)

Measured memory_bytes: 14112
n = int(input())
a = list(map(int, input().split()))

count = 0
first = 0

while first < n:
    for i in range( n-1, first, -1 ):
        if a[i] < a[i-1]:
            t = a[i]
            a[i] = a[i-1]
            a[i-1] = t
            count += 1
    first += 1

print(*a)
print(count)

Measured memory_bytes: 7712
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    ll n; cin >> n;
    vector<ll> a(n+1000); rep(i, n) cin >> a[i];
    ll q; cin >> q;
    ll sum = 0;
    rep(i,n) sum += a[i];
    vector<ll> cnt(100007,0);
    rep(i,n){
        cnt[a[i]]++;
    }
    rep(i,q){
        //rep(i,n) cout << cnt[i] << " ";
        //cout << endl;
        ll b,c; cin>> b >> c;
        ll d = c-b;
        //bの数を数える
        sum += cnt[b]*d;
        cout << sum << endl;
        cnt[c] += cnt[b];
        cnt[b] = 0;
    }
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ d.cpp
./a.out

サンプルのダウンロードは oj d https://atcoder.jp/contests/abc171/tasks/abc171_d
テストは oj t
*/


Measured memory_bytes: 4768
def good(s):
    if s[0] != 'A':
        return False

    cocc = 0
    for x in range(2, len(s) - 1):
        if s[x] == 'C':
            cocc += 1

    if cocc != 1:
        return False

    s = s[1:]
    p = s.index('C')
    s = s[:p] + s[p + 1:]
    return all(c in 'abcdefghijklmnopqrstuvwxyz' for c in s)

def main():
    s = input()
    if good(s):
        print('AC')
    else:
        print('WA')

main()


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String [] S = {sc.next(),sc.next(),sc.next()};
        int [] k = {0,0,0};
        int t=0;
        while(true){
            k[t]++;
            for(int i=0; i<3; i++){
                if(k[i]>S[i].length()){
                    char c = (char)('A'+i);
                    String ans = String.valueOf(c);
                    System.out.println(ans);
                    return;
                }
            }
            t = S[t].charAt(k[t]-1)-'a';
        }
    }
}


Measured memory_bytes: 9672
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
int main(){
   long long n,a=10,s=0;
   cin >>n;
   if(n%2==1 || n<10){
       cout << 0 << endl;
   }
   else{
        for(long long i=0;  i<26; i++){
           s+=n/a;
           a*=5;
        }
        cout << s << endl;
   }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	
	char ch;
	int sum[1000] = {0};
	while((ch = getchar())!=EOF){
		sum[ch]++;
	}
	for(int i=97;i<=122;i++)
		printf("%c : %d\n", i, sum[i]+sum[i-32]);//注意要同时计算进大写和小写 
	

	return 0;
}


Measured memory_bytes: 2700
FACT = [1] * 51
for i in range(1, 51):
    FACT[i] = FACT[i-1] * i


def combination(n, r):
    return FACT[n] // FACT[r] // FACT[n-r]


def main():
    N, A, B = map(int, input().split())
    V = list(map(int, input().split()))
    V.sort(reverse=True)
    print(sum(V[:A]) / A)
    x = V[A-1]
    y = V.count(x)
    ans = 0
    begin = V[:A].count(x)
    end = V[:B].count(x)+1
    for i in range(begin, end):
        if i != begin and x != V[0]:
            continue
        ans += combination(y, i)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
h, w, k = gets.split.map(&:to_i)
c = Array.new(h){gets.chomp.chars.map{|c| (c == '#') ? 1 : 0}}
cnt = 0
[0, 1].repeated_permutation(h).each do |x|
  m = Marshal.load(Marshal.dump(c))
  x.each_with_index do |y, i|
    next if y == 0
    w.times do |j|
      m[i][j] = 0
    end
  end
  [0, 1].repeated_permutation(w) do |u|
    mc = Marshal.load(Marshal.dump(m))
    u.each_with_index do |v, j|
      next if v == 0
      h.times do |i|
        mc[i][j] = 0
      end
    end
    cnt += 1 if mc.flatten.sum == k
  end
end
puts cnt

Measured memory_bytes: 14620
import java.util.*;
import java.math.*;
public class Main{

	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int c[] = new int[n];
		int r[] = new int[n];
		int a[] = new int[k];
		int b[] = new int[k];
		for(int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}
		for(int i = 0; i < k; i++) {
			a[i] = sc.nextInt()-1;
			b[i] = sc.nextInt()-1;
		}
		int[][] dis = new int[n][n];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(i == j) continue;
				dis[i][j] = INF;
			}
		}
		Node[] node = new Node[n];
		for(int i = 0; i < n; i++) {
			node[i] = new Node();
		}
		for(int i = 0; i < k; i++) {
			node[a[i]].edge_to.add(b[i]);
			node[b[i]].edge_to.add(a[i]);
		}
		for(int i = 0; i < n; i++) {
			ArrayDeque<Data> queue = new ArrayDeque<Data>();
			queue.add(new Data(i,0));
			while(!queue.isEmpty()) {
				Data tmp = queue.poll();
				if(tmp.cost > r[i]) break;
				ArrayList<Integer> edge_to = node[tmp.now].edge_to;
				for(int j = 0; j < edge_to.size(); j++) {
					if(dis[i][edge_to.get(j)] <= tmp.cost + 1) continue;
					dis[i][edge_to.get(j)] = tmp.cost + 1;
					queue.add(new Data(edge_to.get(j),tmp.cost+1));
				}
 			}
		}
		for(int i = 0; i < n; i++) {
			node[i].cost = INF;
		}
		PriorityQueue<Data> queue = new PriorityQueue<Data>();
		queue.add(new Data(0,0));
		while(!queue.isEmpty()) {
			Data tmp = queue.poll();
			if(node[tmp.now].cost <= tmp.cost) continue;
			node[tmp.now].cost = tmp.cost;
			node[tmp.now].check = true;
			if(tmp.now == n-1) break;
			for(int i = 0; i < n; i++) {
				if(node[i].check) continue;
				if(dis[tmp.now][i] > r[tmp.now]) continue;
				if(node[i].cost <= tmp.cost + c[tmp.now]) continue;
				queue.add(new Data(i,tmp.cost + c[tmp.now]));
			}
		}
		System.out.println(node[n-1].cost);	
	}
	static class Data implements Comparable<Data>{
		int now;
		int cost;
		Data(int a, int b) {
			now  = a;
			cost = b;
		}
		@Override
		public int compareTo(Data o) {
			return this.cost - o.cost;
		}
	}
	static class Node {
		int cost;
		boolean check;
		ArrayList<Integer> edge_to = new ArrayList<Integer>();
	}
}

Measured memory_bytes: 486880
N,Q = map(int,input().split())
S = input()
left=[]
right=[]
for _ in range(Q):
  l,r = map(int,input().split())
  left.append(l)
  right.append(r)

a = [0]*N
for i in range(1,N):
  if S[i] == "C" and S[i-1] == "A":
    a[i] = a[i-1] + 1
  else:
    a[i] = a[i-1]

#print(a)
ans = []
for j in range(Q):
  ans.append(a[right[j]-1] - a[left[j]-1])

for k in ans:
  print(k)

Measured memory_bytes: 18068
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <algorithm>
using namespace std;

#define ll long long
#define pii pair <int, int>
#define M 1000000007 // 10^9 + 7

long long bigmod (long long a, long long b) {
    if(b==0)
        return 1;

    if(!(b&1)) {
        long long ret = bigmod(a, b/2);
        return ((ret%M)*(ret%M))%M;
    }

    else return ((a%M) * (bigmod(a, b-1)%M))%M;
}

bool cmp (pii p1, pii p2) {   // function for sorting array of pairs
    if(p1.first != p2.first)
        return p1.first < p1.first;
    return p1.second < p2.second;
}

/*bool pr[1001];                 //sieve of Eratosthenes
void sieve(void) {
    for(ll i=2; i<200; i++)
        if(!pr[i])
            for(ll j=i+i; j<1001; j+=i)
                pr[j] = 1;

    pr[0] = pr[1] = 1;
}*/

int main()
{
    //sieve();

    ll a[200002], t, tc = 1, b, c, m, n, i, j, k, p, q ;
    //int t, tc = 1, a, b, c, m, n, i, j, k, p, q;

    while(scanf("%lld%lld", &n, &t) != EOF) {

        for(i=0; i<n; i++)
            scanf("%lld", &a[i]);

        m = 0;
        for(i=1; i<n; i++) {
            m +=  a[i]-a[i-1] > t? t : a[i]-a[i-1];
        }

        m += t;

        printf("%lld\n", m);

    }


    return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;
using ll = long long;

void AGC013A()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for(auto& x : A)
		cin >> x;

	int ct = 1;
	int flag = 0;
	for (int i = 1; i < N; ++i)
	{
		if (flag == 1 && A[i-1] > A[i])
		{
			++ct;
			flag = 0;
		}
		else if (flag == -1 && A[i - 1] < A[i])
		{
			++ct;
			flag = 0;
		}
		else if (flag == 0)
		{
			flag = A[i] > A[i - 1] ? 1 : A[i] < A[i - 1] ? -1 : 0;
		}
	}
	cout << ct << endl;
}

int main()
{
	AGC013A();
	return 0;
}

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

bitset<1000009> bs;
vector<int> primes;

void sieve(int upper_bound) {
    bs.reset();
    bs.set(0);
    bs.set(1);

    for (int i = 2; i < upper_bound; i++) {
        if (bs.test(i)) {
            continue;
        }

        primes.push_back(i);
        for (long long j = 1ll * i * i; j < upper_bound; j += i) {
            bs.set(j);
        }
    }
}

int main() {
    sieve(1000009);
    long long n;
    cin >> n;
    
    vector<int> p;
    int i = 0;
    while (i < (int) primes.size() && n > 1) {
        int cnt = 0;
        while (n % primes[i] == 0) {
            n /= primes[i];
            cnt++;
        }

        if (cnt) {
            p.push_back(cnt);
        }
        i++;
    }

    if (n > 1) {
        n /= n;
        p.push_back(1);
    }

    long long ans = 0;
    for (int i : p) {
        int t = 0;
        for (int j = 1; t + j <= i; j++) {
            t += j;
            ans += 1;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3864
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define mod 1000000007
#define pb push_back
#define F first
#define S second
using namespace std;

int main(void) {
	boost
	;
	ll a;
	cin >> a;
	ll b;
	cin >> b;
	ll c;
	cin >> c;
	ll d;
	cin >> d;
	ll ans=min(b,d)-max(a,c);
	if(ans<0){
		ans=0;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}

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

void bubble_sort(int* p, int n)
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[j], &p[j + 1]);
		}
	}
}

int array_max(int* p, int n)
{
	int max = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] > max)
			max = p[i];
	}
	return max;
}

int binary_search(int* p, int key, int n)
{
	int low = 0, high = n - 1;
	int middle;

	while (low <= high)
	{
		middle = (low + high) / 2;

		if (key == p[middle])
			return key;
		else if (key < p[middle])
			high = middle - 1;
		else if (key > p[middle])
			low = middle + 1;
	}
	return -1;
}

int main()
{
	int N;
	int P[10];
	int Q[10];
	int num[100000] = { 0 };
	int b = 0;

	scanf("%d", &N);

	for (int i = 0; i < N; i++)
		scanf("%d", &P[i]);

	for (int i = 0; i < N; i++)
		scanf("%d", &Q[i]);

	for (int i = 0; i < N; i++)
		b += P[N - i - 1] * pow(10, i);

	bubble_sort(P, N);

	for (int i = 0; i < 100000; i++)
		num[i] = 0;

	int count = 0;

	do
	{
		for (int i = 0; i < N; i++)
			num[count] += P[N-i-1] * pow(10, i);

		count++;
	} while (next_permutation(P, P + N));

	int a = 0;

	for (int i = 0; i < N; i++)
		a += Q[N - i - 1] * pow(10, i);

	count = 0;
	while (1)
	{
		if (a == num[count])
			break;
		count++;
	}
	int count2 = 0;

	while (1)
	{
		if (b == num[count2])
			break;
		count2++;
	}

	printf("%d", ABS(count - count2));
}

Measured memory_bytes: 896
using AtCoderBeginnerContest142.Questions;
using AtCoderBeginnerContest142.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest142.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var nk = inputStream.ReadIntArray();
            var n = nk[0];
            var k = nk[1];
            var h = inputStream.ReadIntArray();

            yield return h.Count(i => i >= k);
        }
    }
}


namespace AtCoderBeginnerContest142
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest142.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest142.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 19296
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;


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

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

int main() {
    int a, b; cin >> a >> b;
    cout << LCM(a, b) << endl;
}

Measured memory_bytes: 256
package main

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

var buf = bufio.NewScanner(os.Stdin)

func scanInt() int {
	buf.Scan()
	i, _ := strconv.Atoi(buf.Text())
	return i
}

func scanInts(n int) []int {
	a := make([]int, n)
	for k, _ := range a {
		a[k] = scanInt()
	}
	return a
}

func main() {
	buf.Split(bufio.ScanWords)

	a := scanInt()
	b := scanInt()
	c := scanInt()

	if a == b && c != a {
		fmt.Println("Yes")
		return
	}
	if b == c && a != b {
		fmt.Println("Yes")
		return
	}
	if c == a && b != c {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n,m;
int cnt[30];
int main(){
	char cc;
	scanf("%d%d\n",&n,&m);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)scanf("%c",&cc),cnt[cc-'a'+1]++;
		getchar();
	}
	int flag=(n&1)+(m&1),a=0,b=0,c=0;
	for(int i=1;i<=26;i++){
		if(cnt[i]&1) c++,cnt[i]-=1;
		if(!cnt[i]) continue;
		if(!(cnt[i]%4)) a++;
		else if(!(cnt[i]%2)) b++;
	}
	if(c>1) return puts("No\n"),0;
	if(n==1||m==1){
		if(flag==2){
			if(c==1) return puts("Yes\n"),0;
			else return puts("No\n"),0;
		}else{
			if(c==1) return puts("No\n"),0;
			else return puts("Yes\n"),0;
		}
	}
	if(!flag){
		if(!b&&!c) return puts("Yes\n"),0;
		else return puts("No\n"),0;
	}
	if(flag==1){
		if(c) return puts("No\n"),0;
		if(n&1) if(b<=m/2) return puts("Yes\n"),0;
		else return puts("No\n"),0;
		if(m&1) if(b<=n/2) return puts("Yes\n"),0;
		else return puts("No\n"),0;
	}
	if(flag==2){
		if(!c) return puts("No\n"),0;
		if(b<=n/2+m/2) return puts("Yes\n"),0;
		else return puts("No\n"),0;
	}
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

template<class T>
class Bit{
public:
	vector<T>bit;
	T cnt;
	Bit(){}
	Bit(int n){
		bit=vector<T>(n+10);
		cnt=0;
	}
	void add(int k,T x){
		k++;
		while(k<(int)bit.size()){
			bit[k]+=x;
			k+=k&-k;
		}
		cnt+=x;
	}
	T sum(int k){
		k++;
		T res=0;
		while(k){
			res+=bit[k];
			k-=k&-k;
		}
		return res;
	}
	T sum2(int k){
		return cnt-sum(k);
	}
};
Bit<int>bit[26];

char C[2];
int main(){
	int n;cin>>n;
	string s;cin>>s;
	int q;cin>>q;
	rep(i,26){
		bit[i]=Bit<int>(n);
	}
	rep(i,n){
		bit[s[i]-'a'].add(i,1);
	}
	rep(i,q){
		int ty;scanf("%d",&ty);
		if(ty==1){
			int a;scanf("%d%s",&a,C);a--;
			char c=C[0];
			bit[s[a]-'a'].add(a,-1);
			s[a]=c;
			bit[s[a]-'a'].add(a,1);
		}
		else{
			int l,r;scanf("%d%d",&l,&r);l-=2;r--;
			int sum=0;
			rep(j,26){
				if(bit[j].sum(r)-(l<0?0:bit[j].sum(l)))sum++;
			}
			printf("%d\n",sum);
		}
	}
}

Measured memory_bytes: 51716