akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




int m,n,q,ans,a[55],b[55],c[55],d[55],temp[12];

void FindAns(int cur,int mn)
{
    if(cur > n)
    {
        int i,cnt=0;
        for(i=0;i<q;i++)
        {
            if(temp[b[i]]-temp[a[i]] == c[i])cnt+=d[i];
        }
        ans=max(ans,cnt);
        return;
    }
    for(int i=mn;i<=m;i++)
    {
        temp[cur]=i;
        FindAns(cur+1,i);
    }
}

int main()
{
    FAST();

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

    int i;
    cin >> n >> m >> q;
    for(i=0;i<q;i++)cin >> a[i] >> b[i] >> c[i] >> d[i];
    FindAns(1,1);
    cout << ans;
    return 0;
}


Measured memory_bytes: 3648
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    static long MOD = 1000000007;

    public static void main(String[] args) {

        //int ans=Integer.MAX_VALUE;
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        HashMap<String,Integer> point = new HashMap<>();
        for(int i=0;i<n;i++){
            String s = sc.next();
            if(point.containsKey(s)){
                int temp = point.get(s);
                point.remove(s);
                point.put(s,temp+1);
            }else{
                point.put(s,1);
            }
        }
        int m=sc.nextInt();
        for(int i=0;i<m;i++){
            String s = sc.next();
            if(point.containsKey(s)){
                int temp = point.get(s);
                point.remove(s);
                point.put(s,temp-1);
            }else{
                point.put(s,-1);
            }
        }
        int ans = Integer.MIN_VALUE;
        for(Integer p:point.values()){
            ans = Math.max(ans,p);
        }
        if(ans<0)ans=0;
        System.out.println(ans);




    }



}




Measured memory_bytes: 21844
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	a := make([]int, n, n)
	fa := make([]int64, n, n)
	fi := make([]int64, n, n)

	const M = 1000000007

	fa[0] = 1
	fi[0] = 1

	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	for i := 1; i < n; i++ {
		fa[i] = (fa[i-1] * int64(i)) % M
		fi[i] = modinv(fa[i], M)
	}

	sort.Ints(a)

	answer := int64(0)
	for i := 0; i < n; i++ {
		tmp := int64(0)
		if i >= k-1 {
			tmp += (fa[i] * fi[k-1]) % M * fi[i-k+1] % M
		}
		if i <= n-k {
			tmp -= (fa[n-i-1] * fi[k-1]) % M * fi[n-k-i] % M
		}

		answer += (int64(a[i])*tmp)%M + M
		answer %= M
	}

	fmt.Println(answer)
}

func modpow(a int64, n int64, m int64) int64 {
	if n == 0 {
		return 1
	}
	tmp := modpow(a, n/2, m)
	if n%2 == 0 {
		return tmp * tmp % m
	}
	return tmp * tmp % m * a % m
}

func modinv(a int64, m int64) int64 {
	return modpow(a, m-2, m)
}


Measured memory_bytes: 6904
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
    init();
    ll count[5]={};
    for(int i=0;i<3;i++){
        ll a,b;cin>>a>>b;
        count[a]++;
        count[b]++;
    }
    if(count[1]==1&&count[2]==1&&count[3]==2&&count[4]==2)cout<<"YES"<<endl;
    else if(count[1]==1&&count[2]==2&&count[3]==1&&count[4]==2)cout<<"YES"<<endl;
    else if(count[1]==2&&count[2]==1&&count[3]==1&&count[4]==2)cout<<"YES"<<endl;
    else if(count[1]==1&&count[2]==2&&count[3]==2&&count[4]==1)cout<<"YES"<<endl;
    else if(count[1]==2&&count[2]==2&&count[3]==1&&count[4]==1)cout<<"YES"<<endl;
    else if(count[1]==2&&count[2]==1&&count[3]==2&&count[4]==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    


}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <string>
using namespace std;
typedef long long LL;

long double a;
LL b,val[2][500005],n,ans = 0;
LL pre[555][555] = {0};
string s;

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(LL ls,i = 1;i <= n;i ++){
		cin >> s; ls = s.length(); LL fld = -1;
		for(LL j = 0;j < ls;j ++) if(s[j] == '.') fld = j;
		if(fld == -1){ fld = ls; s += '.'; } ls = s.length();
		
		b = 0; for(LL j = 0;j < ls;j ++) if(s[j] != '.') b = b * 10 + s[j] - '0';
		for(LL j = 1;j <= 9 - (ls - fld - 1);j ++) b *= 10;
		
		val[0][i] = val[1][i] = 1;
		while(b % 5 == 0){ val[1][i] ++; b /= 5; }
		while(b % 2 == 0){ val[0][i] ++; b /= 2; }
		pre[val[0][i]][val[1][i]] ++;
		if(val[0][i] >= 10 && val[1][i] >= 10) ans --;
	}
	for(LL i = 1;i <= 70;i ++){
		for(LL j = 1;j <= 50;j ++){
			pre[i][j] = pre[i][j] + pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1];
		}
	}
	for(LL ti,tj,i = 1;i <= n;i ++){
		ti = 20 - val[0][i]; tj = 20 - val[1][i];
		if(ti < 1) ti = 1; if(tj < 1) tj = 1;
//		cout << pre[50][30] - pre[50][tj - 1] - pre[ti - 1][20] + pre[ti - 1][tj - 1] << '\n';
		ans += pre[70][50] - pre[70][tj - 1] - pre[ti - 1][50] + pre[ti - 1][tj - 1];
	}
	ans >>= 1;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 6604
from sys import stdin
from numpy import empty

N, M = [int(x) for x in stdin.readline().rstrip().split()]
X = [int(x) for x in stdin.readline().rstrip().split()]

sortX = sorted(X)
dist = empty(M)

for i in range(M-1):
    dist[i] = sortX[i+1] - sortX[i]

sortedDist = sorted(dist, reverse=True)
result = sum(sortedDist[N-1:M-1])
print(int(result))

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,A,B;
  cin>>N>>A>>B;
  vector<ll>v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  sort(rng(v));
  double ans=0;
  ll last=v[N-1-A+1];
  for(int i=0;i<A;i++){
    ans+=v[N-1-i];
  }
  ll nouse=0;
  ll use=0;
  for(int i=0;i<N;i++){
    if(v[i]==last){
      if(i>=N-1-A+1)use++;
      else nouse++;
    }
  }

  vector<vector<ll>>nCr(51,vector<ll>(51,0));
  nCr[0][0]=1;
  for(int i=1;i<=50;i++){
    for(int j=0;j<=50;j++){
      if(j-1>=0)nCr[i][j]=nCr[i-1][j-1]+nCr[i-1][j];
      else nCr[i][j]=nCr[i-1][j];
    }
  }

  bool same=true;
  for(int i=0;i<A-1;i++)if(v[N-1-i]!=v[N-1-i-1])same=false;

  cout<<fixed<<setprecision(10)<<ans/A<<endl;
  if(same){
    ll res=0;
    for(int i=A;i<=B;i++){
      res+=nCr[nouse+use][i];
    }
    cout<<fixed<<setprecision(0)<<res<<endl;
  }
  else cout<<nCr[nouse+use][use]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n = inl();
        repone(i, 3500) {
            repone(j, 3500) {
                ll a = i * j * n, b = 4 * i * j - n * j - n * i;
                if (b > 0 && a >= b && a % b == 0) {
                    printf("%lli %lli %lli\n", i, j, a / b);
                    return 0;
                }
            }
        }

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

#define ff first
#define ss second
#define int long long
#define MOD 1000000007

using namespace std;

int dp[25][2100000];

int popcount(int n){
    if (n==0)
        return 0;
    return 1 + popcount(n&(n-1));
}

signed main() {
    //freopen("input1.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<vector<bool>> mat(n, vector<bool>(n));
    
    int in;
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++){
            cin >> in;
            mat[i][j] = (in==1);
        }
    }
    int mx = pow(2, n) - 1;
    
    for (int i=1; i<=mx; i++)
        dp[0][i] = 0;
    dp[0][0] = 1;
    
    for (int i=1; i<=n; i++){
        for (int j=0; j<=mx; j++){
            dp[i][j] = 0;
            if (i == popcount(j)){
                for(int k=0; k<n; k++){
                    if ( (j&(1<<k)) && mat[i-1][k] ) {
                        dp[i][j] = (dp[i][j] + dp[i-1][j - (1<<k)])%MOD;
                    }
                }
            }
        }
    }
    
    cout << dp[n][mx];

    return 0;
}

Measured memory_bytes: 364492
n, m, k = map(int, input().split())

mod = 10**9 + 7

# (n * m - 2)C(k - 2)
# 距離xの組 -  n - x + 1
# 横 n - x + 1
# 縦 m * m
ans = 0
for y in range(1, n):
    ans += y * (n - y) * m * m % mod
for x in range(1, m):
    ans += x * (m - x) * n * n % mod


def inv(x):
    return pow(x, mod - 2, mod)


# comb
for i in range(k - 2):
    ans = ans * (n * m - 2 - i) * inv(i + 1) % mod

print(ans)


Measured memory_bytes: 9124
'''B - TAKOYAKI FESTIVAL 2019
https://atcoder.jp/contests/abc143/tasks/abc143_b

>>> main(3, [3, 1, 2])
11
>>> main(7, [5, 0, 7, 8, 3, 3, 2])
312

'''

from itertools import combinations


def main(n, d):
    value = 0

    for p in combinations(d, 2):
        value += p[0] * p[1]

    print(value)


if __name__ == "__main__":
    n = int(input())
    d = list(map(int, input().split(' ')))

    main(n, d)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>

using namespace std;

class cPol
{
	vector<string> v;
	stack<int> ss;
	int ans;

	void calc();
	char opStrToChar(const string &);

public:
	cPol(string o)
	{
		istringstream iss(o);
		while (!iss.eof())
		{
			string t;
			iss >> t;
			v.push_back(t);
		}
		calc();
		cout << ans << endl;
	}
};

void cPol::calc()
{
	for (vector<string>::iterator it = v.begin(); it < v.end(); ++it)
	{
		if (!opStrToChar(*it))
		{
			ss.push(std::stoi(*it));
		}
		else
		{
			int a, b;
			b = ss.top();
			ss.pop();
			a = ss.top();
			ss.pop();
			switch (opStrToChar(*it))
			{
				case '+': ss.push(a + b); break;
				case '-': ss.push(a - b); break;
				case '*': ss.push(a * b); break;
				case '/': ss.push(a / b); break;
				default: break;
			}
		}
	}
	ans = ss.top();
	ss.pop();
}

char cPol::opStrToChar(const string &s)
{
	if (s == "+")
	{
		return '+';
	}
	else if (s == "-")
	{
		return '-';
	}
	else if (s == "*")
	{
		return '*';
	}
	else if (s == "/")
	{
		return '/';
	}

	return 0;
}

int main()
{
	string o;
	getline(cin, o);

	cPol cp(o);

	return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
inline int readInt();
int dp[3][105];
int a[3][105];
int main()
{
    int n;
    n = readInt();
    for (int i = 1; i <= 2; ++i)
    {
        for (int j = 1; j <= n; ++j)
        {
            a[i][j] = readInt();
        }
    }
    for (int i = 1; i <= 2; ++i)
    {
        for (int j = 1; j <= n; ++j)
        {
            a[i][j] = max(a[i][j] + a[i - 1][j], a[i][j] + a[i][j - 1]);
        }
    }
    cout << a[2][n] << endl;
    return 0;
}

inline int readInt()
{
    int s = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-')
            f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        s = (s << 1) + (s << 3) + (c ^ 48);
        c = getchar();
    }
    return f * s;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
using ld=long double;
using P=pair<ld,pair<int,int> >;
struct edge{int to;ld cost;};
const int INF=1<<29;
const int MAX_V=100010;
vector<edge> G[32];
ld dp[32][1<<8];
int t[10];
int n,m,p,a,b;
//O(E*logV)
void dijkstra(int s){
  priority_queue<P,vector<P>,greater<P>> que;
  REP(i,m)REP(j,1<<n)dp[i+1][j]=INF;
  dp[s][0]=0;
  que.push(P(0,make_pair(s,0)));
  while(!que.empty()){
    P p=que.top();que.pop();
    auto v=p.second;
    REP(i,n){
      if((v.second&(1<<i)))continue;
      int nn=v.second|(1<<i);
      if(dp[v.first][nn]<p.first)continue;
      for(edge e:G[v.first]){
	if(dp[e.to][nn]>dp[v.first][v.second]+e.cost/t[i]){
	  dp[e.to][nn]=dp[v.first][v.second]+e.cost/t[i];
	  que.push(P(dp[e.to][nn],make_pair(e.to,nn)));
	}
      }
    }
  }
  double result=*min_element(dp[b],dp[b]+(1<<n));
  if(result==INF)printf("Impossible\n");
  else printf("%.3lf\n",result);
}

int main(){ _;
  int x,y;
  double z;
  while(cin>>n>>m>>p>>a>>b,(n|m|p|a|b)!=0){
    REP(i,n)cin>>t[i];
    REP(i,32)G[i].clear();
    REP(i,p){
      cin>>x>>y>>z;
      G[x].push_back(edge{y,z});
      G[y].push_back(edge{x,z});
    }
    dijkstra(a);
  }
}

Measured memory_bytes: 6264
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        String S = next();
        if(S.substring(0, N/2).equals(S.substring(N/2, N))){
            println("Yes");
        }else{
            println("No");
        }
    }

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

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 21712
#pragma once
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()

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

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

	ll A, B;

	cin >> A >> B;

	ll n = gcd(A, B);
	ll ans = 1;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ans++;
			while (n % i == 0) {
				n /= i;
			}
		}
	}

	if (n != 1) ans++;
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static double slope(double[] A, double[] B){
    double slope = (B[1]-A[1])/(B[0]-A[0]);
    return slope;
  }

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++) {
      double [][] point = new double[4][2];
      for (int j = 0; j < 4; j++) {
        for (int k = 0; k < 2; k++) {
          point[j][k] = sc.nextDouble();
        }
      }
      if(slope(point[0], point[1]) == slope(point[2], point[3])) {
        System.out.println("YES");
      }
      else {
        System.out.println("NO");
      }
    }
  }
}

Measured memory_bytes: 12000
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define p push
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/
ll ans = 0;
ll n;
void dfs(ll now, ll nowcolour, vector<vector<pair<ll, ll>>>& graph, vector<bool>& visited) {
	ll newcolour = 1;
	visited[now] = true;
	ll i = 0;
	for(auto a : graph[now]) {
			if (a.second == 0) {
				if (visited[a.first] == false) {
					if (nowcolour == newcolour)++newcolour;
					graph[now][i].second = newcolour;
					dfs(a.first, newcolour, graph, visited);
					++newcolour;
					}
			}
			++i;
	}
	ans = max(ans, newcolour);
}

int main() {

	scanf("%lld", &n);
	vector<vector<pair<ll, ll>>> graph(n);
	vector<bool> visited(n);
	vector<pair<int, int>> anss(n - 1);
	ll a, b;
	rep(i, n - 1) {
		scanf("%lld%lld", &a, &b);
		graph[a - 1].pb(make_pair(b - 1, 0));
		graph[b - 1].pb(make_pair(a - 1, 0));
		anss[i] = make_pair(a - 1, b - 1);
	}
	dfs(0, 0, graph, visited);
	printf("%lld\n", ans - 1);
	for (auto a : anss) {
		ll ansa = -1, ansb = -1;
		for (auto b : graph[a.first]) {
			if (b.first == a.second)ansa = b.second;
		}
		if(ansa == -1)for (auto b : graph[a.second]) {
			if (b.first == a.first)ansb = b.second;
		}
		if (ansa == -1 && ansb == -1)continue;
		else printf("%lld\n", max(ansa, ansb));
	}

	Please AC;
}

Measured memory_bytes: 10752
using System;
class Program{
	static long[] s;
	static int[,] arr;
	static void Main(){
		s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		arr=new int[s[0],s[1]];
		int ans=0;
		for(int i=0;i<s[0];i++){
			string q=Console.ReadLine();
			for(int j=0;j<s[1];j++){
				if(q[j]=='.'){arr[i,j]=int.MaxValue;ans++;}
				else{arr[i,j]=-1;}
			}
		}
		fu(0,0,0);
		Console.WriteLine("{0}",arr[s[0]-1,s[1]-1]==int.MaxValue?-1:ans-arr[s[0]-1,s[1]-1]-1);
	}
	static void fu(int x,int y,int p){
		if(arr[x,y]>p){
			arr[x,y]=p;
			if(x!=s[0]-1||y!=s[1]-1){
				if(x!=0){fu(x-1,y,p+1);}
				if(y!=0){fu(x,y-1,p+1);}
				if(x!=s[0]-1){fu(x+1,y,p+1);}
				if(y!=s[1]-1){fu(x,y+1,p+1);}
			}
		}
	}
}

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

using namespace std;
 
int main()
{
    string s;
    string ans = "yes";

    cin >> s;
    sort(s.begin(), s.end());

    for(int i = 0; i < s.size()-1; i++) {
        if(s[i] == s[i+1]) {
            ans = "no";
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 


int main() {
    int n, m; 
    unordered_map<int, int> ds, ts;
    cin >> n;
    rep(i, n) {
        int d; cin >> d;
        ds[d]++; 
    }
    cin >> m;
    rep(i, m) {
        int t; cin >> t;
        ts[t]++; 
    }
    if (n < m) {
        cout << "NO" << endl;
        return 0;
    }
    for(auto& t : ts) {
        if (ds[t.first] < t.second) {
            cout << "NO" << endl;
            return 0;
        }
    } 
    cout << "YES" << endl;
    return 0;
}

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

int main(void) {
    int a,b;
    cin>>a>>b;
    int c=a+b;
    int d=a-b;
    int e=a*b;
    if (c<=d&&e<=d) {
        cout<<d<<endl;
    } else if (d<=c&&e<=c) {
        cout<<c<<endl;
    } else if (c<=e&&d<=e) {
        cout<<e<<endl;
    }
}

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

using namespace std;

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

  int count = 0;
  bool flag = true;
  if (S[0] != 'A') flag = false;
  for (int i = 1; i < S.size(); i++) {
    if (isupper(S[i])) {
      if (i == 1 || i == S.size() - 1 || S[i] != 'C')
        flag = false;
      else
        count++;
    }
  }
  cout << ((flag && count == 1) ? "AC" : "WA") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include <deque>

using namespace std;
typedef long long ll;

vector<ll> ans;

int main() {
	while (1) {
		ll N, num = 0;
		cin >> N;
		if (N == 0)break;
		for (int i = 1; i < N; i++) {
			for (int j = 2; j <= N - i; j++) {
				if ((2 * i + j - 1)*j / 2 == N)num++;
				if ((2 * i + j - 1)*j / 2 > N)break;
			}
		}
		ans.push_back(num);
	}
	for (int i = 0; i < ans.size(); i++)cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

vector<int> g[100005];
int pre[100005],vis[100005];
queue<int> q;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		int a,b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);  
	}
	q.push(1);
	vis[1] = 1;
	while( !q.empty() )
	{
		int x = q.front();
		q.pop();
		for (int i = 0; i < g[x].size(); i++)
		{
			int t = g[x][i];
			if( vis[t] ) continue;
			pre[t] = x;
			vis[t] = 1;
			q.push(t); 
		}
	}
	int flag = 0;
	for (int i = 1; i <= n; i++)
	{
		if( vis[i] == 0 )
		{
			flag = 1;
			break;
		}
	}
	if( flag ) cout << "No" << '\n';
	else
	{
		cout << "Yes" << '\n'; 
		for (int i = 2; i <= n; i++)
		{
			cout << pre[i] << '\n';
		}
	}
	return 0;
}


Measured memory_bytes: 10476
function Main(input){
  var A = parseInt(input.split(' ')[0], 10);
  var B = parseInt(input.split(' ')[1], 10);
  var C = parseInt(input.split(' ')[2], 10);

  if(A === B){
    console.log(C);
  } else if(A === C){
    console.log(B);
  } else {
    console.log(A);
  }
}

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

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;

map<ll, ll> mp;

void bunkai(ll p){
  ll maxv = pow(p, 0.5) + 1;
  for (ll i = 2; i <= maxv; i++) {
    while(p % i == 0){
      mp[i]++;
      p /= i;
    }
  }
}


int main(){
  ll n, p;
  cin >> n >> p;
  if(n == 1){
    cout << p << endl;
    return 0;
  }
  bunkai(p);
  // print(mp);

  ll res = 1;

  for(auto i : mp){
    ll tmp = i.second / n;
    if(tmp < 1) continue;
    res *= pow(i.first, tmp);
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define pb push_back
#define pii pair<int64_t,int64_t>
#define mp make_pair
#define whole(v) begin(v),end(v)
#define print64_t(c,n) for(int64_t i=0;i<n;i++) cout << c[i] << " ";
#define MOD 1000000007
#define INF 0x3f3f3f3f
int64_t dp[100005][3];
vector<int64_t> a,b,c;
int main()
{
	
   	std::ios::sync_with_stdio(false);
	cin.tie(0);
   	int64_t n;
   	cin >> n;
   	a.reserve(n),b.reserve(n),c.reserve(n);
   	for(int64_t i=0;i<n;i++){
   		int64_t x,y,z;
   		cin >> x >> y >> z;
   		a.eb(x),b.eb(y),c.eb(z);
   	} 
   	dp[0][0] = a[0];
   	dp[0][1] = b[0];
   	dp[0][2] = c[0];
   	for(int64_t i=1;i<n;i++){
   		dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a[i]; 
   		dp[i][1] = max(dp[i-1][2],dp[i-1][0]) + b[i]; 
   		dp[i][2] = max(dp[i-1][1],dp[i-1][0]) + c[i]; 
   	}
   	cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
   	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<double,int>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}
void chmax(ll& x, ll y) {if (x<y) x=y;}

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

Measured memory_bytes: 256
N = gets.to_i
h = gets.split.map(&:to_i)
INF = Float::INFINITY
dp = Array.new(100010){INF}

dp[0]=0

N.times do |i|
  dp[i] = [dp[i],dp[i-1]+(h[i]-h[i-1]).abs].min
  if i>1
    dp[i] = [dp[i],dp[i-2]+(h[i]-h[i-2]).abs].min
  end
end

puts dp[N-1]

Measured memory_bytes: 11396
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int H = scanner.nextInt();
            int W = scanner.nextInt();
            if (H == 0 && W == 0) break;
            for (int h = 0; h < H; h++) {
                char c = (h % 2 == 0 ? '#' : '.');
                for (int w = 0; w < W; w++) {
                    System.out.print(c);
                    c = (c == '.' ? '#' : '.');
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 36304
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
 #pragma GCC target("avx", "avx2")
#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define int long long
#define double ld
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
const int N = 1000;
int dp[N][N];
char c[N][N];
signed main() {
    accell();
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> c[i][j];
            dp[i][j] = 1e9;
        }
    }
    dp[0][0] = (c[0][0] == '#');
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (i)
                dp[i][j] = min(dp[i][j], dp[i - 1][j] + (c[i - 1][j] == '.' && c[i][j] == '#'));
            if (j)
                dp[i][j] = min(dp[i][j], dp[i][j - 1] + (c[i][j - 1] == '.' && c[i][j] == '#'));
        }
    }
    cout << dp[n - 1][m - 1];
    return 0;
}



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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n, m, r;
	cin >> n >> m >> r;
	vector<vector<int>> city(n, vector<int>(n, 1e9));
	vector<int> vis(r);
	for(int i = 0; i < n; i++) {
		city[i][i] = 0;
	}
	for(int i = 0; i < r; i++) {
		cin >> vis[i];
		vis[i]--;
	}
	sort(vis.begin(), vis.end());
	for(int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		city[a][b] = city[b][a] = c;
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			for(int k = 0; k < n; k++) {
				city[j][k] = min(city[j][k], city[j][i] + city[i][k]);
			}
		}
	}
	int ans = 1e9;
	do {
		int tmp = 0;
		for(int i = 1; i < r; i++) {
			tmp += city[vis[i - 1]][vis[i]];
		}
		ans = min(tmp, ans);
	} while(next_permutation(vis.begin(), vis.end()));
	cout << ans << endl;
	return 0;	
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    int n,m,c;
    cin>>n>>m>>c;
    int b[m];
    rep(i,m)cin>>b[i];
    int ans=0;
    rep(i,n)
    {
        int tans=0;
        rep(j,m)
        {
            int a;
            cin>>a;
            tans+=a*b[j];
        }
        tans+=c;
        if(tans>0)ans++;

    }
    cout<<ans;
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

ll f(ll x)
{
  if (x < 0)
    return 0;
  if (x % 4 == 0)
    return x;
  else if (x % 4 == 1)
    return 1;
  else if (x % 4 == 2)
    return x + 1;
  else if (x % 4 == 3)
    return 0;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll a, b;
  cin >> a >> b;
  cout << (f(b) ^ f(a - 1)) << endl;
  return 0;
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<ll> h(N);
    for (int i = 0; i < N; i++)
        cin >> h[i];
    sort(h.begin(), h.end());
    ll ans = 1001001001LL;
    for (int i = 0; i < N - K + 1; i++)
    {
        ans = min(h[i + K - 1] - h[i], ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
void get_unique(vector<T>& x) {
    x.erase(unique(x.begin(), x.end()), x.end());
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    ll d, t, s;
    cin >> d >> t >> s;
    cout << (t * s >= d ? "Yes" : "No") << endl;
}

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

int main(void){
    int n, t;
    cin >> n >> t;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];\
    
    vector<vector<int>> dp1(n, vector<int>(t, 0)), dp2(n, vector<int>(t, 0));
    rep(i, n) {
        for (int j = t-(a[i]+1); j >= 0; j--)
            dp1[i][j+a[i]] = max(dp1[i][j+a[i]], dp1[i][j]+b[i]);
        if (i < n-1)
            for (int j = 0; j < t; j++)
                dp1[i+1][j] = dp1[i][j];
    }
    
    for (int i = n-1; i >= 0; i--) {
        for (int j = t-(a[i]+1); j >= 0; j--) 
            dp2[i][j+a[i]] = max(dp2[i][j+a[i]], dp2[i][j]+b[i]);
        if (i != 0)
            for (int j = 0; j < t; j++)
                dp2[i-1][j] = dp2[i][j];
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < t; j++) {
            if (i != 0 && i != n-1)
                ans = max(ans, b[i]+dp1[i-1][j]+dp2[i+1][t-1-j]);
            else if (i == 0)
                ans = max(ans, b[i]+dp2[i+1][t-1-j]);
            else
                ans = max(ans, b[i]+dp1[i-1][j]);
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
char A[1000],B[1000];
using namespace std;
int main()
{
	int N;
	scanf("%d",&N);
	scanf("%s%s",A+1,B+1);
	for(int i=1;i<=N;i++)
	{
		cout<<A[i];
		cout<<B[i];
	}
	return 0;
}

Measured memory_bytes: 256
mn=list(map(int,input().split()))
m=mn[0]
n=mn[1]
M=[]

while n>1:
    if n%2==1:
        M.append(m%1000000007)
    m=pow(m,2)%1000000007
    n=n//2
    
for i in range(len(M)):
    m=(m*M[i])%1000000007
print(m)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define PII pair<int,int>
#define s second
#define f first
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
ll MOD = 998244353;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x)%MOD;
        }
        p = p >> 1;
        x = (x*x)%MOD;
    }
    return res;
}
int main() {
    IO;
    int n, w;
    cin >> n >> w;
    ll weight[n], value[n];
    ll sum = 0;
    for(int i = 0; i < n; i++){
        cin >> weight[i] >> value[i];
        sum += value[i];
    }
    ll dp[n][sum+1];
    for(int i = 0; i <= sum; i++){
        dp[0][i] = INT_MAX;
    }
    dp[0][0] = 0;
    dp[0][value[0]] = weight[0];
    for(int i = 1; i < n ; i++){
        for(int j = 0; j <= sum; j++){
            dp[i][j] = dp[i-1][j];
            if(j-value[i] >= 0 ){
                dp[i][j] = min(dp[i][j], weight[i] + dp[i-1][j-value[i]]);
            }

        }
    }
    int ans = 0;
    for(int i = 0; i <= sum; i++){
        if(dp[n-1][i] <= w){
            ans = i;
        }
    }
    cout << ans;


    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll r,d,a;
    cin>>r>>d>>a;
    rep(i,10){
        a = r*a-d;
        cout<<a<<endl;
    }
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
#include<cmath>
#include<map>
#include <limits>
# include <iomanip>
#include <queue>
#define INF 1000000009;

using namespace std;
int gcd(int a, int b) {
	while (a % b != 0) {
		int c = 0;
		c = a % b;
		a = b;
		b = c;
	}
	return  b;
}
int kaizyo(int a) {
	long long ans = 1;
	for (int i = a; i > 0; i--) {
		ans *= i;
		ans = ans % 1000000007;
		//cout << ans << endl;
	}
	ans = ans % 1000000007;
	return ans;
}

int main() {
	int a = 0, right = 0, left = -1; int counto = 0, ans = 0;
	vector <int> H;
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> right;
		if (left >= right) {
			counto++;
			
		}
		else{
			ans = max(ans, counto);
			counto = 0;
		}
		left = right;
	}
	ans = max(ans, counto);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3644
#include <stdio.h>

int n;
int x, y, s, answer;
double X, Y, P1, P2;

int main(void){
	int i, j, p;
	for (;;){
		scanf("%d %d %d", &x, &y, &s);
		if (x+y+s==0) break;
		answer=0;
		P1=(double)x/100;
		P2=(double)y/100;
		for (i=1;i<=1000;i++){
			for (j=1;j<=1000;j++){
				
				X=(double)i, Y=(double)j;
				X*=(1.0+P1), Y*=(1.0+P1);
				p=(int)(X+0.00000000001)+(int)(Y+0.00000000001);
				if (p==s){
					X=(double)i, Y=(double)j;
					X*=(1.0+P2), Y*=(1.0+P2);
					p=(int)(X+0.00000000001)+(int)(Y+0.00000000001);
					if (p>answer){
						answer=p;
					}
				}
			}
		}
		printf("%d\n", answer);
	}
	return false;
}

Measured memory_bytes: 1028
n = int(input())
h = list(map(int,input().split()))
ans = 'Yes'
max = 0

for i in range(n):
  if h[i] > max:
    max = h[i] - 1
  elif h[i] < max:
    ans = 'No'
    break
    
print(ans) 
    

Measured memory_bytes: 20612
#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[i];
	}
	int ans = (int)1e9;
	for (int i = -100;i <= 100;i++) {
		int sum = 0;
		for (int j = 0;j < n;j++) {
			sum += (int)pow(a[j] - i, 2);
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
                 
void show_ret(int cards[], char mark) {
    for(int i = 1; i < 14; i ++) {
        if(cards[i] == 0) std::cout << mark << " " << i << std::endl;
    }            
}

int main(int argc, char *argv[]) {
    int spade[14] = {0};
    int heart[14] = {0};
    int clab[14] = {0};
    int dia[14] = {0};
    int n, num = 0;
    char mark;  
     
    std::cin >> n;
    for(int i = 0; i < n; i++) {
        std::cin >> mark >> num;
        switch(mark) {
            case 'S':
                spade[num] = 1;
                break;
            case 'H':
                heart[num] = 1;
                break;
            case 'C':
                clab[num] = 1;
                break;
            case 'D':
                dia[num] = 1;
                break;
        }
    } 
    show_ret(spade, 'S');
    show_ret(heart, 'H');
    show_ret(clab, 'C');
    show_ret(dia, 'D');
    return 0;
}

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

int main(){
int N=0,M=0;

cin>>N;
int h[N],m[N];
for(int i=0; i<N; i++) cin>>h[i]>>m[i];

cin>>M;
int k[M],g[M],all[M+N];
for(int i=0; i<M; i++) cin>>k[i]>>g[i];

for(int i=0; i<M+N; i++){
 if(i<N) all[i]=h[i]*60+m[i];
 else all[i]=k[i-N]*60+g[i-N];
}

for(int i=0; i<M+N-1; i++){
 for(int j=M+N-1; j>i; j--){
   int tmp=0;
   if(all[j]<all[j-1]){
     tmp=all[j-1];
     all[j-1]=all[j];
     all[j]=tmp;
    }
  }
}

for(int i=0; i<M+N-1; i++){
 if(all[i]==all[i+1]) i++;
 if(i<M+N-1){
 if(all[i]%60<10) cout<<all[i]/60<<':'<<0<<all[i]%60<<' ';
 else cout<<all[i]/60<<':'<<all[i]%60<<' ';
}
}
 if(all[M+N-1]%60<10) cout<<all[M+N-1]/60<<':'<<0<<all[M+N-1]%60;
 else cout<<all[M+N-1]/60<<':'<<all[M+N-1]%60;
cout<<endl;
return 0;
}

Measured memory_bytes: 1160
n,m=map(int,input().split())
l=list(map(int,input().split()))
not_good=[]
for i in range(m):
  a,b=map(int,input().split())
  if l[a-1]>l[b-1]:
      not_good.append(b)
  elif l[a-1]<l[b-1]:
      not_good.append(a)
  else:
    not_good.append(a)
    not_good.append(b)
 
not_good=set(not_good)
print(n-len(not_good))

Measured memory_bytes: 20160
"""
 SpeedForces
 Ah shit here we go again

"""

from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def solve():
    s = input()
    id = 1
    valid = ['R']
    for i in s:
      if((id&1 and(i=='L')) or (id%2==0 and i=='R')):
        print("No")
        break
      id+=1
    else:
      print("Yes")





    return
















def main():
    # for _ in range(int(input())):
        solve()

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
pr = print
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")
ll = lambda : list(map(int,input().split()))
vv = lambda :map(int,input().split())
# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 30188
import java.io.*;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String key = br.readLine();
		str=str+str;
		if(str.indexOf(key)!=-1) System.out.println("Yes");
		else System.out.println("No");
	}
}

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

int main(){
	int x;
	cin >> x;
	if(x >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int INF = (int)1e9 + 7;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x <<
//cin,coutより遅いので注意
template <class T = int>
void in() //in<string>();とか書く intのときはそのままin();
{
    T x;
    cin >> x;
    return (x);
}
template <class T>
void print(T &x) { cout << x << "\n"; }

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

    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size() - 1] << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    int minn=min(a,b);
    int maxn=max(a,b);
    for(int i=minn;i<=maxn;i++)
    {
        if(i%k==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<math.h>
using namespace std;

int main(){
    long long a,b,c,d=0,e=0;
    cin>>a>>b;
    for(long long i=0;i<max(a,b);i++){
    if(abs(a-i)==abs(b-i)){cout<<i; return 0;}
    }
    cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 3572